摘要:
自增列必须是主键吗 不一定的,MySQL 每张表只能有1个自动增长字段,这个自动增长字段即可作为主键,也可以用作非主键使用,但是请注意将自动增长字段当做非主键使用时必须必须为其添加唯一索引,否则系统将会报错。例如: 将自动增长字段设置为主键。 create table t1 (id int auto 阅读全文
摘要:
创建存储过程 delimiter && create procedure pro_name (in id int, out count_num int) reads sql date begin select count(*) from t_book where book_type = id; en 阅读全文
摘要:
insert into 表名 (字段,字段...) values (值,值...) select (字段) from 表名 where 条件 delete from 表名 where 条件 update 表名 set 字段=值,字段=值 where 条件 别名 order by 字段 规则 规则 d 阅读全文