i.e. Are following declarations equivalent?
CREATE TABLE example_table (
id INTEGER PRIMARY KEY,
name TEXT
)
and
create table example_table (
id integer primary key,
name text
)
I think upper case is pain to edit, but I already spotted that the .schema
command in the interactive mode remembers the case. Also the documentation always uses the upper-case versions.
I tested it with this code and it seems that the names are case-insensitive:
CREATE TABLE table_sensitive (
id INTEGER PRIMARY KEY,
some_int INTEGER,
some_text TEXT
);
create table table_insensitive (
id integer primary key,
some_int integer,
some_text text
);
INSERT INTO table_sensitive ( id, some_int, some_text )
VALUES ( 'not an integer key', 'a value', 123 );
insert into table_insensitive ( id, some_int, some_text )
values ( 'not an integer key', 'a value', 123 );
INSERT INTO table_sensitive ( id, some_int, some_text )
VALUES ( 0, '123', 123 );
insert into table_insensitive ( id, some_int, some_text )
values ( 1, '123', 123 );
SELECT typeof(id), typeof(some_int), typeof(some_text) FROM table_sensitive;
select typeof(id), typeof(some_int), typeof(some_text) from table_insensitive;
The result was:
Error: near line 13: datatype mismatch
Error: near line 16: datatype mismatch
integer|integer|text
integer|integer|text
(Error on inserts with non-integer primary keys and type casting works for strings containing integers for both versions.)
This means that you can pretty much write keywords and types lowercase, which is what I wanted to know.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With