赞
踩
create database mydb15_indexstu;
use mydb15_indexstu;
create table student(
sno int primary key auto_increment,
sname varchar(30) not null unique,
ssex varchar(2) check(ssex='男' or ssex='女') not null,
sage int not null,
sdept varchar(10) default'计算机' not null);
create table course(
cno int primary key not null,
cname varchar(20) not null);
create table sc(
sno int not null,
cno varchar(10) primary key not null,
score int not null);
alter table student modify sage smallint;
create index cno_index on course(cno);
show create table course\G
create index sc_index on sc(sno,cno asc);
show create table sc\G
create view stu_info as select sname,ssex,cname,score from student join sc on student.sno=sc.sno join course on sc.cno=course.cno;
show tables;
drop index cno_index on course;
drop index sc_index on sc;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。