常用sql操作总结_尚硅谷_宋红康(3)
时间:2025-03-10
时间:2025-03-10
drop column birthday;
3.清空表中的数据(与delete from table_name区分开) truncate table emp2;
4.重命名表 rename emp2 to emp3;
5.删除表
drop table emp3;
数据处理 DML
1)增
1.1 增添一条记录
insert into [表名](,,,,,)
values(,,,,,)
1.2 从其它表中拷贝数据
insert into [表名]
select .... from [另一个表]
where ....
2)改
update [表名]
set .....
where ....
3)删
delete from [表名]
where ....
4)查(最常用的数据库操作)
select ....
from …
where ….
group by …
having …
order by ….
约 束
对创建的表的列属性、字段进行的限制。诸如:not null/unique/primary key/foreign key/check