Welcome Guest, Not a member yet? Register   Sign In
Dealing with typelessness in SQLite
#1

[eluser]Xeoncross[/eluser]
I have been reading about SQLite 2 Data Types and SQLite 3 Data Types I discovered that in SQLite 2 there are only 2 types:

Quote:INTEGER (Primary key)
TEXT (everything else)

In SQLite 3 there are a few more:

Quote:NULL. The value is a NULL value.

INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.

REAL. The value is a floating point value, stored as an 8-byte IEEE floating point number.

TEXT. The value is a text string, stored using the database encoding (UTF-8, UTF-16BE or UTF-16-LE).

BLOB. The value is a blob of data, stored exactly as it was input.


But even with these new types in SQLite 3 - you can store anything in any column (except id). So my question is - why even define the column type in "CREATE TABLE table" queries when it really doesn't seem to matter?

Basically is there anything wrong with this code?
Code:
CREATE TABLE posts(
id INTEGER PRIMARY KEY,
title,
text,
author,
time);
#2

[eluser]Xeoncross[/eluser]
bump




Theme © iAndrew 2016 - Forum software by © MyBB