在SQLServer2005中用語(yǔ)句創(chuàng)建數(shù)據(jù)庫(kù)和表

字號(hào):

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
    -- 還原當(dāng)前功能(xp_cmdshell)的配置信息為初始狀態(tài).
    RECONFIGURE
    GO
    EXEC sp_configure 'show advanced options', 0
    GO
    -- 最后,還原當(dāng)前高級(jí)選項(xiàng)的配置信息為初始狀態(tài)
    RECONFIGURE
    GO