When using this query :
INSERT INTO order (order_quantity)
VALUES (\'50\')
I\'m getting an error :
You ha
Reserved words are not recommended for use as database, table, column, variable or other object names. If you desire to use a reserved word is used as an object name in ANSI standard syntax, it must be enclosed in double-quotes to allow the Relational Engine (whichever that one is) that the word is being used as an object and not as a keyword in the given context.
Here are some examples specific to different SQL engines:
order
is a SQL Keyword, used to sort results (ORDER BY ...
)
Wrap backticks around it if you are using MySQL or Maria DB
INSERT INTO `order` (order_quantity) VALUES ('50');
Wrap brackets around it if you are using MS SQL Server
INSERT INTO [order] (order_quantity) VALUES ('50');
Wrap double quotes around it if you are using pgSQL
INSERT INTO "order" (order_quantity) VALUES ('50');
In example, nothing (but common sense) prevents you from creating a database named INSERT
with a table INTO
having a column VALUE(42)
Yes, this query works :
USE [INSERT];
SELECT [INTO].[VALUE(42)] FROM [INTO];