I'm a beginner with sqliteand used to insert values in the fields of datatype text with single quote and values of datatype integer without single quote.

But I realized that sqlite accepts inserting both data types (text and integer) with single quote without error.

For example the table:

  id integer PRIMARY KEY,
  type_id integer,
  name text );

I can insert type_id without single quote:

INSERT INTO foods (name, type_id) VALUES ('Rice', 16);

And also with single quote:

INSERT INTO foods (name, type_id) VALUES ('Bean', '17');

select * FROM foods;

423         16          Rice
424         17          Bean

What are the consequences of inserting values in fields of datatype integer with single quotes?

What are the effects on database size and performance?

Can I have problems in the future to make a query using logical operators in these fields?

I'm making this question because it is simpler to implement in my interface a routine to assemble a list of fields and values by inserting single quotation marks in all elements of the list of values.

Otherwise I would have to identify the datatype of each field to decide whether or not to include the quotes.

Thank you,

sqlite-users mailing list

Reply via email to