MySQL 练习笔记 | 杂七杂八
2019-08-14 本文已影响0人
赏花
select * from t_staff; /* 查询获取表中数据 */
/* 查看表结构 */
describe t_staff;
desc t_staff;
/*
alter table xxx (x, x, x)value (x, x, x)
drop table xxx
create table xxx()
其余的直接tablename 不需要加table */
- mysql删除包含外键的数据表时会报错:
- 办法1:先关闭外键,再删除。
select @@foreign_key_checks;
set foreign_key_checks = 0;
delete from s_dept;
- 若想把id序列也清空到从1开始,则办法2:
truncate table tb_name