之前在MySQL建表和查询的时候都用的单引号,后来发现有问题,同学提醒要用反引号,最近发现反引号也会出问题:
1.
2.
在网上看到有说,反引号是为了区分MySQL的保留字和普通字符,这样的话第2个可以解释,但是第1个是为什么呢。
其实单引号和反引号的实际不同是什么?MySQL在对这两个符号的操作是怎样的?
求解,谢谢。
动态WEB网站中的PHP和MySQL详细反映实际程序的需求,仔细地探讨外部数据的验证(例如信用卡卡号的格式)、用户登录以及如何使用模板建立网页的标准外观。动态WEB网站中的PHP和MySQL的内容不仅仅是这些。书中还提到如何串联JavaScript与PHP让用户操作时更快、更方便。还有正确处理用户输入错误的方法,让网站看起来更专业。另外还引入大量来自PEAR外挂函数库的强大功能,对常用的、强大的包
508
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 (“`”):
A string is a sequence of bytes or characters, enclosed within either single quote (“'”) or double quote (“"”) charactersMySQL :: MySQL 5.5 Reference Manual :: 9.1.1 String Literals 最简单的避免错误的方法就是,表名等保留字用反引号,其他例如SQL语句用双引号,我平时就尽量不用单引号的 简单说字符串用单引号,表名,字段名等用反引号
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号