`
BabyDuncan
  • 浏览: 575532 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

关于mysql的大小写问题

阅读更多
mysql到底是区别大小写还是不区别呢,这取决于所使用的操作系统,如在windows下:
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cookbook           |
| db                 |
| mysql              |
| test               |
+--------------------+
5 rows in set (0.28 sec)

mysql> use COOKBOOK;
Database changed
mysql>

可以看出,是不区分大小写的,cookbook == COOKBOOK;
在linux下呢:
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cookbook           |
| mysql              |
+--------------------+
3 rows in set (0.00 sec)

mysql> use COOKBOOK;
ERROR 1049 (42000): Unknown database 'COOKBOOK'
mysql> use cookbook;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> 

可以看出,在linux系统下cookbook 是不等于COOKBOOK的。
——————————————————
通常情况下,对于保留字我们用大写字母,其他标识符用小写,从《mysql核心技术》这本书中看到的,决定以后按照这种规范处理关于数据库方面的问题。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics