MySQL中單引號和反引號的區別是什麼?

時間 2021-06-01 06:26:46

1樓:八五影食

單引號和反引號使用場景

反引號是為了區分MySQL的保留字與普通字元而引入的符號。

例:create database `create`;

如果不用反引號,MySQL將把create視為保留字而導致出錯,所以,有MySQL保留字作為欄位的,必須加上反引號來區分。

引號一般用在字段的值,如果字段值是字元或字串,則要加引號,如:select=『字段值』

不加反引號建的資料庫或表不能包含MySQL保留字,否則出錯。

2樓:魯小夫

注意學習。

Certain objects within MySQL, including database, table, index,

column, alias, view, stored procedure, partition, tablespace, and

other object names are known as identifiers

An identifier may be quoted or unquoted. If an identifier contains special characters or is a reserved word, you must quote it whenever you refer to it.

The identifier quote character is the backtick (「`」):

MySQL :: MySQL 5.5 Reference Manual :: 9.2 Schema Object Names

A string is a sequence of bytes or characters, enclosed within

either single quote (「'」) or

double quote (「"」) characters

MySQL :: MySQL 5.5 Reference Manual :: 9.1.1 String Literals

python 單引號中怎麼引用變數 ?

黃哥 用字串格式化,前面佔坑,後面變數去填坑。format a b c a,b,c format a b c 2.7 only a,b,c format a b c c,b,a format abc unpacking argument sequence c,b,a format abra cad ...

hive中怎麼匯入帶引號的csv檔案

kidong wang 如果每個列都帶雙引號,有一種變通的方法 匯入原始csv檔案,對映為所有列都是string型別的表,建立檢視來處理雙引號和型別轉換。 Gerodan hive CREATE TABLE csv1 table a string,b string ROWFORMAT SERDE o...

德語中Kaisertum和Reich的區別是什麼?

準確說兩者都無關乎 帝國 這個詞語的所指 指主標題中的 Kaiser 愷撒,或曰皇帝,即承自羅馬帝國 神聖羅馬帝國的統治者頭銜。tum是德語裡的乙個字尾,可以指地位 權位等,故Kaisertum一詞接近於皇位 皇權的意思,大致可模擬Imperial Power這樣的概念。總的來說,Kaisertum...