a):求年龄在20-30岁之间,张姓学生按年龄升序排序;
b):求有相同年龄学生的全部信息;
请哪位仁兄学姐赐教!!!不胜感激!!!
create table #student(
id int identity(1,1) not null primary key,
name nvarchar(60),
age smallint
)
insert into #student(name,age) values(N'张天',16)
insert into #student(name,age) values(N'李四',24)
insert into #student(name,age) values(N'赵六',31)
insert into #student(name,age) values(N'张七',40)
insert into #student(name,age) values(N'王五',10)
insert into #student(name,age) values(N'陈八',22)
insert into #student(name,age) values(N'马九',16)
insert into #student(name,age) values(N'曾十',24)
--1
select * from #student where age between 20 and 30 order by name asc
--2
select * from #student where age in(select age from #student group by age having count(age)>1) order by id
drop table #student
女孩权益保护协会
请问那个#student 是什么啊,我试了你的命令,可是select * from #student,drop table #student的时候却找不到表,到企业管理器中也没有发现,是怎么回事,麻烦指导下
创的临时表
create table #student(
id int identity(1,1) not null primary key,
name nvarchar(60),
age smallint
)
这里创建的临时表