Silentdoer

导航

MySQL随记

1.MySQL表字段千万不能用MySQL关键字,比如key,value等,否则一些ORM框架在保存数据时会提示:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server。。。

 

2.MySQL里之所以有的时候需要将select出来的数据as为一个临时表名,有的时候又不需要是因为不需要的时候是这种情况select * from A where id in (select a_id from ...),因为in接的是一个数组而非一张表,所以不能as为一个表;

而如果是这种select* from ((select m, n from B where ...) as tmp),这种就必须要一个临时表名,因为from后面是接的表而非一个数组数据;(MySQL里的数组是()来包裹,而编程语言里是[])

 

3.尽量不要用外键

posted on 2020-06-10 16:40  Silentdoer  阅读(110)  评论(0编辑  收藏  举报