問題描述
例如mysql引用表名使用
For example, mysql quote table name using
SELECT * FROM `table_name`;
注意`
其他數據庫是否曾經使用不同的字符來引用他們的表名
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.
這篇關于不同的數據庫使用不同的名稱引用嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!