4 月 202023
 

Source: Do different databases use different name quote?

The standard SQL language uses double-quotes for delimited identifiers:

SELECT * FROM "my table";

MySQL uses back-quotes by default. MySQL can use standard double-quotes:

SELECT * FROM `my table`;
SET SQL_MODE=ANSI_QUOTES;
SELECT * FROM "my table";

Microsoft SQL Server and Sybase uses brackets by default. They can both use standard double-quotes this way:

SELECT * FROM [my table];
SET QUOTED_IDENTIFIER ON;
SELECT * FROM "my table";

InterBase and Firebird need to set the SQL dialect to 3 to support delimited identifiers.

Most other brands of database use double-quotes correctly.

This use of quotes is called delimited identifiers. It’s an important part of SQL because otherwise you can’t use identifiers (e.g. table names and column names) that:

  • Include whitespace: “my table”
  • Include special characters and punctuation: “my-table”
  • Include international characters: “私のテーブル”
  • Are case-sensitive: “MyTable”
  • Match SQL keywords: “table”

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

CAPTCHA Image
Play CAPTCHA Audio
Reload Image