不同的数据库使用不同的名称引号吗? [英] Do different databases use different name quote?
问题描述
例如,使用
SELECT * FROM `table_name`;
注意`
其他数据库是否曾经使用过不同的char来引用其表名
Does other database ever use different char to quote their table name
推荐答案
引号的这种使用称为定界标识符.这是SQL的重要组成部分,因为否则您将不能使用以下标识符:
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:
- 包括空格:我的桌子"
- 包括特殊字符和标点符号:"my-table"
- 包括国际字符:私のテーブル"
- 区分大小写:"MyTable"
- 匹配SQL关键字:表"
标准的SQL语言使用双引号来分隔标识符:
The standard SQL language uses double-quotes for delimited identifiers:
SELECT * FROM "my table";
MySQL默认使用反引号. MySQL可以使用标准的双引号:
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和Sybase默认情况下使用方括号.他们都可以通过以下方式使用标准的双引号:
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和Firebird需要将SQL方言设置为3,以支持带分隔符的标识符.
InterBase and Firebird need to set the SQL dialect to 3 to support delimited identifiers.
大多数其他品牌的数据库正确使用双引号.
Most other brands of database use double-quotes correctly.
这篇关于不同的数据库使用不同的名称引号吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!