sqlserver的增删改查
select * from shuiguo 查询表 select * from shuiguo where jiage between 5 and 7 ( between 表示大于等于 5 且小于等于 7 的范围) select distinct name from shuiguo -- 去除重复,只针对一列 select * from shuiguo where name = ' 苹果 ' and chandi
select*from shuiguo 查询表
select * from shuiguo where jiage between 5 and 7(between表示大于等于5且小于等于7的范围)
select distinct name from shuiguo--去除重复,只针对一列
select * from shuiguo where name='苹果' and chandi='海南'
select * from shuiguo where name in('苹果','香蕉')--name只包含苹果,香蕉的
select * from shuiguo where name not in('苹果','香蕉')--name中除了苹果,香蕉的
select * from shuiguo where name like '%苹%'--模糊查询,%叫通配符(%在前面表示前面有任何字符,%在后面表示后面有任何字符)
select * from shuiguo where name like '苹_'--下划线表示任意一个字符
select * from shuiguo order by jiage--升序排列
select * from shuiguo order by jiage desc --降序排列
select top 2* from shuiguo order by jiage--按升序排列,只取前两行(top 2)
select top 1 * from shuiguo where name='苹果' order by jiage desc--按照条件查询后排序,查名字叫苹果的谁的价格高,只选第一个
delete from shuiguo where chandi='烟台' --删除水果表中产地是烟台的数据
alter table shuiguo add dianhua int --添加列名电话
update shuiguo set dianhua= 2255557 where code=2 --定义第几行的电话是多少
修改表加入新列 alter table abc add dianhua int
修改表删除一列 alter table abc drop column dianhua
上一篇: 不使用U盘破解win7登录密码
下一篇: 备份活动目录的四种技巧