Types in SQLite

bawltherapistSoftware and s/w Development

Dec 13, 2013 (4 years and 7 months ago)


Types in SQLite
• SQLite has its own types, including:
• It also allows you to use the typical SQL types, but it converts
them to one of its own types.
• As a result, the length restrictions indicated for CHAR
and VARCHAR are not observed.
• It is also more lax in type checking than typical DBMSs.
String Comparisons
• String comparisons ignore any trailing spaces added for padding.
• ex:- an attribute named id of type CHAR(5)
- insert a tuple with the value 'abc'for id
- value is stored as 'abc'(with 2 spaces of padding)
- the comparison id = 'abc' is true for that tuple
• In standard SQL, string comparisons using both = and LIKE
are case sensitive.
• some DBMSs provide a case-insensitive version of LIKE
• In SQLite:
• there are no real CHARs, so padding isn't added
• string comparisons using = are case sensitive
• string comparisons using LIKE are case insensitive
'abc' = 'ABC'is false
'abc' LIKE 'ABC'is true