扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:赛迪网 Alice 来源:天新网 2008年3月22日
关键字: 数据库 Mssql SQL SQL Server
在本页阅读全文(共2页)
alter table Team
add
constraint UK_captainId unique(captainId)--唯一约束
go
insert into Team values("第一组",1)
insert into Team values("第二组",2)
insert into Team values("第三组",3)
insert into Team values("第四组",4)
insert into Team values("第五组",5)
insert into Student values("小强","男","1982-6-9","23456789451","来自河北",1)
insert into Student values("小昭","男","1987-6-9","78945678945","山东",4)
insert into Student values("小溪","男","1982-6-9","65987845651","抚顺",3)
insert into Student values("小怜","男","1981-6-9","25487965423","天津",5)
insert into Student(name,sex,birthday,phone,tId) values("李真","男","1984-6-9","25487965423",5)
select * from Team
select * from Student
if exists (select * from sysobjects where name="teacher")
drop table teacher
go
create table teacher
(
id int identity (1,1) primary key,
name varchar(20),
address varchar(20)
)
go
insert into teacher values("zhang","hubei")
insert into teacher values("wang","hubei")
insert into teacher values("li","hubei")
insert into teacher values("chen","hunan")
insert into teacher values("zhao","hunan")
insert into teacher values("tian","guangdong")
insert into teacher values("ma","guangdong")
insert into teacher values("chang","tianjin")
insert into teacher values("liang","beijing")
select * from teacher
select count(*),address from teacher group by address having address<>"hunan"
--按地址分组查询并用having字句筛选出地址不是‘hunan’的
EXEC sp_configure "xp_cmdshell", 0
GO
-- 还原当前功能(xp_cmdshell)的配置信息为初始状态.
RECONFIGURE
GO
EXEC sp_configure "show advanced options", 0
GO
-- 最后,还原当前高级选项的配置信息为初始状态
RECONFIGURE
GO
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者