大家好,又见面了,我是你们的朋友全栈君。
高级数据库布置的实验作业
题目: 设计与实现一个旅游预订系统,该系统涉及的基本信息有航班,出租车,宾馆和客户等数据信息。实体和其特征属性举例如下: FLIGHTS (String flightNum, int price, int numSeats, int numAvail, String FromCity, String ArivCity); HOTELS(String name,String location, int price, int numRooms, int numAvail); CARS(String type,String location, int price, int numCars, int numAvail); CUSTOMERS(String custName); RESERVATIONS(String custName, int resvType, String resvKey) 根据自己的经验给出该旅游系统数据库设计E/R图(可以增加实体和属性),然后基于此数据库完成如下功能: 1. 航班,出租车,宾馆房间和客户基础数据的入库,更新。 2. 预定航班,出租车,宾馆房间。 3. 查询航班,出租车,宾馆房间,客户和预订信息。 4. 查询某个客户的旅行线路。 5. 其他任意你愿意加上的功能。 要求: 1) E/R图中包含弱实体,子集联系等,关系中元组数 〉=20 。 2) 提交文档:E/R图及解释,E/R图到关系模式的转换及说明,分析给出关系的模式属于哪个NF,然后讨论其模式优化。完成的功能及说明。系统实现的环境。各关系元组数据文件及说明。 3) 提交系统:源程序及可执行程序,测试用例。
city
;
CREATE TABLE city
(
cityName
varchar(20) NOT NULL,
PRIMARY KEY (cityName
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;customer
;
CREATE TABLE customer
(
password
varchar(50) NOT NULL,
custName
varchar(50) NOT NULL,
type
int(10) DEFAULT 1,
PRIMARY KEY (custName
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;car
;
CREATE TABLE car
(
carNum
varchar(50) NOT NULL,
price
int(10) DEFAULT 0,
cityName
varchar(50) NOT NULL,
PRIMARY KEY (carNum
),
CONSTRAINT carcityName
FOREIGN KEY (cityName
) REFERENCES city
(cityName
) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;hotel
;
CREATE TABLE hotel
(
hotelName
varchar(50) NOT NULL,
price
int(10) DEFAULT 0,
numRooms
int(10) DEFAULT 0,
cityName
varchar(50) NOT NULL,
PRIMARY KEY (hotelName
),
CONSTRAINT hotelcityName
FOREIGN KEY (cityName
) REFERENCES city
(cityName
) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;flight
;
CREATE TABLE flight
(
flightNum
varchar(20) DEFAULT NULL,
price
int(10) DEFAULT 0,
numSeats
int(10) DEFAULT 0,
fromCity
varchar(50) NOT NULL,
arivCity
varchar(50) NOT NULL,
PRIMARY KEY (flightNum
),
CONSTRAINT fromCity
FOREIGN KEY (fromCity
) REFERENCES city
(cityName
) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT arivCity
FOREIGN KEY (arivCity
) REFERENCES city
(cityName
) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;reservation
;
CREATE TABLE reservation
(
resvKey
varchar(50) NOT NULL,
custName
varchar(50) NOT NULL,
type
int(10) NOT NULL,
resDate
DATE,
KEY reservationkey
(resvKey
,custName
,type
,resDate
),
CONSTRAINT reservationcust
FOREIGN KEY (custName
) REFERENCES customer
(custName
) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;参见github链接
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/130303.html原文链接:https://javaforall.cn