美文网首页
mysql 关键字和保留字有哪些

mysql 关键字和保留字有哪些

作者: 饱饱想要的灵感 | 来源:发表于2023-08-15 11:42 被阅读0次

mysql5.7

参考官网 https://dev.mysql.com/doc/refman/5.7/en/keywords.html

mysql8

  1. 参考官网 https://dev.mysql.com/doc/refman/8.0/en/keywords.html

  2. 使用语句查询查询

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);

相关文章

网友评论

      本文标题:mysql 关键字和保留字有哪些

      本文链接:https://www.haomeiwen.com/subject/vsjhmdtx.html