mysql求每个班级的最高分_SQL 如何查找一个表里,每个班级各个学科的最高分?...

```sql-- Create tablecreate table CLASS(classno INTEGER not null,classname NVARCHAR2(32));-- Add comments to the columnscomment on column CLASS.classnois '班级编号';comment on column CLASS.classnameis '...
摘要由CSDN通过智能技术生成

```sql

-- Create table

create table CLASS

(

classno INTEGER not null,

classname NVARCHAR2(32)

);

-- Add comments to the columns

comment on column CLASS.classno

is '班级编号';

comment on column CLASS.classname

is '班级名称';

-- Create/Recreate primary, unique and foreign key constraints

alter table CLASS

add constraint PK_CLASS primary key (CLASSNO);

-- Create table

create table STUDENT

(

s# INTEGER not null,

sname NVARCHAR2(32),

sage INTEGER,

ssex NVARCHAR2(8),

classno INTEGER

);

-- Add comments to the columns

comment on column STUDENT.s#

is '学号';

comment on column STUDENT.sname

is '姓名';

comment on column STUDENT.sage

is '年龄';

comment on column STUDENT.ssex

is '性别';

comment on column STUDENT.classno

is '班级编号';

-- Create/Recreate primary, unique and foreign key constraints

alter table STUDENT

add constraint PK_STUDENT primary key (S#);

alter table STUDENT

add constraint FK_STUDENT_CLASS foreign key (CLASSNO)

references CLASS (CLASSNO);

-- Create table

create table TEACHER

(

t# INTEGER not null,

tname NVARCHAR2(16)

);

-- Add comments to the columns

comment on column TEACHER.t#

is '教师编号';

comment on column TEACHER.tname

is '教师姓名';

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值