show databases;
-- drop database studentinformation;
-- create database studentinformation default charset=utf8;
use studentinformation;
-- -- 学生表(student)
create table if not exists student(
sno varchar(3) primary key,
sname varchar(4) not null,
ssex varchar(2) ,
sbrithday datetime ,
class varchar(5) not null
);
alter table student modify ssex enum('男','女') default '男';
-- -- -- 课程表(course)
create table if not exists course(
cno varchar(5) primary key,
cname varchar(10) not null,
tno varchar(10) not null
);
-- -- 成绩表(grade)
create table if not exists grade(
sno varchar(3) ,
cno varchar(5) ,
degree numeric(3) not null,
primary key(sno,cno)
);
-- -- 教师表(teacher)
create table if not exists teacher(
tno varchar(3) primary key
mysql-练习-增删改查
最新推荐文章于 2023-08-14 21:33:51 发布