sql修改字段名称,增加字段,更改类型,删除字段 和数据优化


一、exec sp_rename 'student.name','names' --修改表字段名称

alter table student alter column courseid int--修改表的字段类型

alter table student add age int --z增加字段

alter table student drop column age--删除字段

 

二、exitst的用法

select * from 表A where exists(select * from 表B where 表B.id=表A.id)

这句相当于

select * from 表A where id in (select id from 表B)

 

三、数据优化

https://zhuanlan.zhihu.com/p/65058992

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM