"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How Do Different Databases Handle Delimited Identifiers for Table and Column Names?

How Do Different Databases Handle Delimited Identifiers for Table and Column Names?

Posted on 2025-03-25
Browse:526

How Do Different Databases Handle Delimited Identifiers for Table and Column Names?

Different Name Quotes in Databases

Databases employ delimited identifiers to allow the use of table and column names that may contain characters such as whitespace, special characters, international characters, and case-sensitive identifiers. Different databases use various characters for these delimiters.

MySQL

MySQL uses back-quotes by default. However, it supports standard double-quotes when the SQL_MODE is set to ANSI_QUOTES:

SELECT * FROM `my_table`;  // MySQL default
SELECT * FROM "my_table";  // MySQL with ANSI_QUOTES

Microsoft SQL Server and Sybase

These databases use brackets as default delimiters. They also support double-quotes using the following setting:

SELECT * FROM [my_table];  // Default
SET QUOTED_IDENTIFIER ON;
SELECT * FROM "my_table";

InterBase and Firebird

These databases require setting the SQL dialect to 3 to use delimited identifiers.

SET SQL DIALECT 3;  // Enable delimited identifiers
SELECT * FROM "my_table";

Other Databases

Most other databases, including standard SQL, use double-quotes as delimited identifiers:

SELECT * FROM "my_table";

By using delimited identifiers, database users can create table and column names that are not otherwise supported by SQL.

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3