数据库上机

发布时间:2021-06-11

create table employ(
ecardid char(20),
eid char(20) not null,
ename char(20) not null,
esex char(20) not null,
etelenum char(20),
position char(20),
primary key (eid),
check (esex in ('男','女')),
check(position in('员工'))
)
create table manage(
mcardid char(20),
mid char(20) not null,
mname char(20) not null,
msex char(20) not null,
mtelenum char(20),
position char(20),
primary key (mid),
check (msex in ('男','女')),
check(position in('经理'))
)
create table menu(
dishno char(20),
danjia float(20) not null unique,
dishname char(20) not null unique,
pingzong char(20),
worktime char(20),
shiduan char(20) not null unique,
primary key(dishno),
check(pingzong in('主菜','特价菜','酒水','主食')),
check (shiduan in('早','中','晚'))
)
create table work(
mid char(20),
eid char(20),
worktime char(20),
shiduan char(20) ,
riqi char(20),
primary key(mid),
check (worktime in('星期一','星期二','星期三','星期四','星期五')),
check (shiduan in('早','中','晚')),
foreign key (mid) references manage(mid),
foreign key (eid) references employ(eid),
foreign key (shiduan) references menu(shiduan)
)

create table discount (
num char(20),
discount char(20),
dishname char(20) not null,
pingzong char(20),
primary key(num),
check (pingzong in('主菜')),
foreign key (dishname) references menu(dishname)
)

create table xiadan(
eid char(20),
shiduan char(20) not null,
dishname char(20) not null,
qty smallint,
danjia float(20) not null,
num char(20) not null,
primary key(eid),
foreign key (eid) references employ(eid),
foreign key (shiduan) references menu(shiduan),
foreign key (dishname) references menu(dishname),

foreign key (num) references discount(num)
)
create database restaurant
create table manage(
mcardid char(20),
mno char(20) not null unique ,
mname char(20) not null,
msex char(20) not null,
mtelenum char(20),
position char(20),
primary key (mno),
check (msex in ('男','女')),
check(position in('经理'))
)
create table employ(
ecardid char(20),
eno char(20) not null,
ename char(20) not null,
esex char(20) not null,
etelenum char(20),
position char(20),
primary key (eno),
check (esex in ('男','女')),
check(position in('员工'))
)
create table breakfast(
bname char(20),
bno char(20),
bprice float(3),
primary key (bno)
)
drop table lunch;
create table lunch(
lname char(20) not null unique,
lno char(20),
ltype char(20) not null unique,
lprice float(3) not null unique,
primary key (lno),
check (ltype in('zucai','zushi','jiushui','tenjiacai'))
)
create table super(
sname char(20),
sno char(20),
sprice float(3),
primary key (sno)
)
create table worktime(
mno char(20) not null,
eno char(20),
dailytime char(20),
fhours smallint,
shours smallint,
dates char(20),
primary ke
y(dates,mno),
check (dailytime in('morning','noon','night')),
check ((fhours-shours)=5 and (shours=6 or shours=11 or shours=16) and (fhours=11

数据库上机.doc 将本文的Word文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:7 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219