mysql 关键字和保留字有哪些
2023-08-15 本文已影响0人
饱饱想要的灵感
mysql5.7
参考官网 https://dev.mysql.com/doc/refman/5.7/en/keywords.html
mysql8
-
使用语句查询查询
SELECT WORD FROM INFORMATION_SCHEMA.KEYWORDS WHERE RESERVED = 1;
因此, 使用以下语句可以查询列名和表名是否占用mysl关键字
SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'databeName' AND COLUMN_NAME IN (SELECT WORD FROM INFORMATION_SCHEMA.KEYWORDS WHERE RESERVED = 1);
SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'databeName' AND TABLE_NAME IN (SELECT WORD FROM INFORMATION_SCHEMA.KEYWORDS WHERE RESERVED = 1);