Looking for sql Answers? Try Ask4KnowledgeBase
Looking for sql Keywords? Try Ask4Keywords

SQL Select columns which are named after reserved keywords


Example

When a column name matches a reserved keyword, standard SQL requires that you enclose it in double quotation marks:

SELECT 
    "ORDER",
    ID 
FROM ORDERS

Note that it makes the column name case-sensitive.

Some DBMSes have proprietary ways of quoting names. For example, SQL Server uses square brackets for this purpose:

SELECT 
    [Order],
    ID 
FROM ORDERS

while MySQL (and MariaDB) by default use backticks:

SELECT 
    `Order`,
    id 
FROM orders