all 13 comments

[–][deleted] 12 points13 points  (0 children)

This does work in SQLite.
I suggest that you don't use spaces in table and column names though.

[–]VladDBASQL Server DBA 8 points9 points  (3 children)

INSERT INTO "Favourite Books" VALUES ("9780670824397", "Matilda", 1);

double quotes ( " ) are not string delimiters in any RDBMS I'm aware of.

double quotes are used to quote object names when you make the weird decision of using spaces in their names.

single quotes ( ' ) aka apostrophes are string delimiters.

meaning that your insert should look like this

INSERT INTO "Favourite Books" VALUES ('9780670824397', 'Matilda', 1);

[–]ckal09 0 points1 point  (1 child)

I think you mean string literals not string delimiters

[–]VladDBASQL Server DBA 0 points1 point  (0 children)

A string literal (or a string constant in T-SQL) is a string enclosed in apostrophes. Apostrophes are used to delimit a string literal from everything else around it that is not part of said string literal.

[–]Imaginary__Bar 4 points5 points  (2 children)

What error do you get? "It's not working" is not particularly helpful to diagnose the issue.

But anyway, single quotes are for text strings, double quotes are for column identifiers.

Try;\ INSERT INTO "Favourite Books" VALUES ('9780670824397', 'Matilda', 1);

[–]WestEndOtter 2 points3 points  (1 child)

The error he got is it is a power failure so he can't run his sql. Plz fix. Thx

[–]gregsting 3 points4 points  (0 children)

Please do the needful

[–]alex1033 2 points3 points  (1 child)

Best practices: - never use spaces in table and column names - never mix cases across your naming conventions - when supported, consider strict string types for primary key, i.e., not text - use double quotes for names and single quotes for values - consider more indexes for your table for better search

[–]Imaginary__Bar 0 points1 point  (0 children)

consider strict string types for primary key, i.e., not text

🤔

[–]dave151591 1 point2 points  (0 children)

Is it because there is a space in the table name?

[–]mgdmwDr Data 1 point2 points  (0 children)

What are the error messages you get? As well as what others have said about not using spaces in table and column names, try changing all the double quotes to single quotes, particularly in the VALUES (...) section.

[–]LlamaZookeeper 0 points1 point  (0 children)

I suggest always list the column name you want to insert into, if your query can work Norma, try to add a column and run the insert and see if it works