日期:2014-05-16  浏览次数:20902 次

mysql学习1,mysql的关键字

?? ? 近些日子开始重新学习了下mysql,主要学习mysql的各种命令。期间遇到了不少问题。最恼人的是无意中我用了一个mysql的保留字做字段,用的是describe,结果导致各种插不进数据。。。。我是无论如何没有想过这个单词是保留字。。。。。。。最后调半天,终于意识到它有可能是保留字,一查文档,果然是。。。。。坑爹啊,浪费了大把时间。。。mysql的保留字如下:

1.ACCESSIBLE ?ADD ?ALL ?ALTER ?ANALYZE ?AND ?AS ?ASC ?ASENSITIVE?

2.BEFORE ?BETWEEN ?BIGINT ?BINARY ?BLOB ?BOTH ?BY?

3.CALL ?CASCADE ?CASE ?CHANGE ?CHAR ?CHARACTER ?CHECK ?COLLATE ?COLUMN ?CONDITION CONSTRAINT ?CONTINUE ?CONVERT ?CREATE ?CROSS ?CURRENT_DATE ?CURRENT_TIME CURRENT_TIMESTAMP ?CURRENT_USER ?CURSOR?

4.DATABASE ?DATABASES ?DAY_HOUR ?DAY_MICROSECOND ?DAY_MINUTE ?DAY_SECOND ?DEC DECIMAL DECLARE ?DEFAULT ?DELAYED ?DELETE ?DESC ?DESCRIBE ?DETERMINISTIC ?DISTINCT ?DISTINCTROW ?DIV DOUBLE ?DROP ?DUAL

5.EACH ?ELSE ?ELSEIF ?ENCLOSED ?ESCAPED ?EXISTS ?EXIT ?EXPLAIN

6.FALSE ?FETCH FLOAT ?FLOAT4 ?FLOAT8 ?FOR ?FORCE ?FOREIGN ?FROM ?FULLTEXT?

7.GRANT ?GROUP?

8.HAVING ?HIGH_PRIORITY ?HOUR_MICROSECOND ?HOUR_MINUTE ?HOUR_SECOND

9.IF ?IGNORE ?IN ?INDEX ?INFILE ?INNER ?INOUT ?INSENSITIVE ?INSERT ?INT ?INT1 ?INT2 ?INT3 ?INT4 ?INT8 INTEGER ?INTERVA L INTO ?IS ?ITERATE?

10.JOIN?

11.KEY KEYS KILL?

12.LEADING LEAVE LEFT LIKE LIMIT LINEAR LINES LOAD LOCALTIME LOCALTIMESTAMP LOCK?

LONG LONGBLOB LONGTEXT LOOP ?LOW_PRIORITY

13.MASTER_SSL_VERIFY_SERVER_CERT ?MATCH MEDIUMBLOB MEDIUMINT MEDIUMTEXT MIDDLEINT MINUTE_MICROSECOND MINUTE_SECOND MOD MODIFIES?

14.NATURAL NOT NO_WRITE_TO_BINLOG NULL NUMERIC?

15.ON OPTIMIZE OPTION OPTIONALLY OR ORDER OUT OUTER OUTFILE

16.PRECISION PRIMARY PROCEDURE PURGE

17.RANGE READ READS READ_WRITE REAL REFERENCES REGEXP RELEASE RENAME REPEAT REPLACE REQUIRE RESTRICT RETURN REVOKE RIGHT RLIKE?

18.SCHEMA ?SCHEMAS ?SECOND_MICROSECOND ?SELECT ?SENSITIVE ?SEPARATOR ?SET ? SHOW SMALLINT ?SPATIAL ?SPECIFIC ?SQL ?SQLEXCEPTION ?SQLSTATE ?SQLWARNING ?SQL_BIG_RESULT

SQL_CALC_FOUND_ROWS ?SQL_SMALL_RESULT ?SSL ?STARTING ?STRAIGHT_JOIN

19.TABLE TERMINATED THEN TINYBLOB TINYINT TINYTEXT TO TRAILING TRIGGER TRUE?

20.UNDO UNION UNIQUE UNLOCK UNSIGNED UPDATE USAGE USE USING UTC_DATE UTC_TIME UTC_TIMESTAMP?

21.VALUES VARBINARY VARCHAR VARCHARACTER VARYING?

22.WHEN WHERE WHILE WITH WRITE

23.XOR?

24.YEAR_MONTH?

25.ZEROFILL?

这些保留字均不能用于列名和表名。

另外,创建表时,varchar必须显示指定长度(在命令行下)。

1 楼 Technoboy 2011-06-22  
楼主太逗了
2 楼 jxb_happy 2011-06-22  
Technoboy 写道
楼主太逗了

见笑了