CodeIgniter Forums
Dealing with typelessness in SQLite - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Dealing with typelessness in SQLite (/showthread.php?tid=11364)



Dealing with typelessness in SQLite - El Forum - 09-05-2008

[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);



Dealing with typelessness in SQLite - El Forum - 09-10-2008

[eluser]Xeoncross[/eluser]
bump