zxpr.net
当前位置:首页 >> 假设“学生课程”数据库中包含学生表、课程表、学生选课表3个表 >>

假设“学生课程”数据库中包含学生表、课程表、学生选课表3个表

您好,您这样:--1 select Sname,Sage from Student where Sage<(select Sage from Student where Sno='某一学生') and Sdept='数学系' --2 select Sname from Student where Sno in (select Sno from SC)--3 select Sname from Student where Sno in (select Sno from SC group by Sno having count(*)=(select count(*) from Course ))

1: 学生表 create table student(s# int primary key,name char(80),sex char(20),age int,dept char(50))2课程表 create table course(c# int primary key,cname char(50),kh char(50),score numeric(5,2))3成绩表 create table sc(s# int primary key,c# char(50) not null, score numeric(5,2))

//自己把中文替换成英文字段名 我用的sql server数据库select 学号、姓名、性别、年龄、所在系 from 学生 order by 年龄 desc, 学号 ascselect 学号,姓名 from 学生 where 姓名 in( select 姓名 from 学生 group by 姓名 having count(*)>1 )update 成

1.select distinct Sno from SC2.select distinct Sno from SC where Grade3.select Sno,Grade from SC where Cno='3' order by Grade desc4.是要查询没门课程的最高分和最低分么?select max(Grade),min(Grade) from SC6.select * from Student where Sdept=(select Sdept from Student where Sname='刘晨')

(π sno,cname(c|><|sc))÷(π sno(s))

create table [Student](Sno char(8) not null primarykey,Sname varchar(8) not nullSsex varchar(8) not nullSage varchar(8) not nullSdept varchar(8) not null)INSERT INTO Student (Sno,Sname,Ssex,Sage,Sdept)select ('12345', '张三', '男', '20', '英

6.有一个“学生-课程”数据库,数据库中包括三个表: (1)“学生”表Student由学号、姓名、性别、年龄、所在系五个属性组成,可记为: Student(学号,姓名,性别,年龄,所在系),学号为关键字. (2)“课程”表Course由课程号、课

以oracle 为例:1、create table student( Sno number(10) primary key, Sname varchar2(20), Ssex varchar2(2), Sage number(10), Sdept varchar2(20));2、SELECT * FROM student FROM Sdept='计算机' ORDER BY Sno DESC3、SELECT

1.查询所有学生的学号、姓名、所在系Select sno,sname,sdeptFrom student2.查询全体学生的学号、姓名、性别,年龄,系别的信息Select *From student3.查询全体学生的姓名及其出生年份Select sname,datadiff(year,sage,2010) as 出生年份

1.select Sno,Sname from Student2.select Sname,Sage from Student3,Select Sno from SC4.Select Sname,Sage from Student Group By Sno having avg(Sage) < 205.Select Sno, Cno from SC where Grade IS NOT NULL

相关文档
网站首页 | 网站地图
All rights reserved Powered by www.zxpr.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com