MySQL是一種常用的關系型數據庫管理系統,有時候我們需要對數據庫進行排序,這就要用到MySQL的關鍵字。MySQL的關鍵字可以以大小寫不敏感的形式書寫,下面是MySQL關鍵字從小到大的排序:
ADD ALL ALTER AND AS ASC AUTO_INCREMENT BETWEEN BY CASE CHARACTER SET CHECK COLLATE COLUMN CONSTRAINT CREATE CROSS CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP DATABASE DEFAULT DELETE DESC DISTINCT DROP ELSE ELSEIF ENCLOSED ENUM ESCAPE EXISTS FALSE FIELDS FOREIGN FROM FULLTEXT GRANT GROUP HAVING IF IGNORE IN INDEX INNER INSERT INTO IS JOIN KEY KEYS KILL LIKE LIMIT LOAD DATA INFILE LOCK LOCAKED MATCH MAXVALUE MINVALUE MODIFY NOT NULL ON OPTIMIZE OPTION OPTIONALLY OR ORDER OUTER OUTFILE PRIMARY PROCEDURE READ REFERENCES REGEXP RENAME REPLACE REQUIRE RESTRICT RETURN REVOKE RIGHT RLIKE SELECT SET SHOW SMALLINT TABLE TERMINATED THEN TO TRIGGER TRUE UNION UNIQUE UNLOCK UNSIGNED UPDATE USAGE USE USING VALUES VARCHAR VARYING WHEN WHERE WITH WRITE XOR YEAR_MONTH ZEROFILL
需要注意的是,MySQL的關鍵字不建議用作表名、列名及其他標識符。如果使用了關鍵字,需要使用反引號將其括起來,例如:
CREATE TABLE `order` ( `id` INT, `name` VARCHAR(20), `details` TEXT );
以上是MySQL從小到大的關鍵字排序,通過了解這些關鍵字,可以更好地使用MySQL進行數據庫操作。