On Wednesday 04 January 2006 02:54 pm, Mark Wyszomierski wrote: > Hi all, > > I switched to sqlite from mysql awhile ago, I maintained the field types > in my sqlite implementation such as: > > create table students (first_name TEXT, age INTEGER); > > I'm just wondering if there is any point to specifying the field type as if > I try adding a string type into the age field, it seems to be accepted ok: > > insert into students values('hello'); > > Does sqlite have any problem regarding setting a field defined as INTEGER > from a text string (any limits etc?), are there any performance gains to be > had with specifying the field type?
sqlite does not care about types. You can insert BLOBs into INTEGER fields if it makes you happy. sqlite will not care. I recommend you place them in your definitions anyway, for two reasons. First, you might want to switch to a different database latter. Second, it is sometimes helpful to tell your successors what you intend a field to be. Even though sqlite doesn't care, it is a good idea to be more strict yourself. As the other response said, sqlite used NULL for the unspecified parameters.