cs-3431-assignment-1/Cruise.sql

51 lines
1.2 KiB
MySQL
Raw Normal View History

2019-08-27 02:06:41 +00:00
CREATE TABLE Reservation(
reservationID NUMBER,
customerID NUMBER,
cruiseID NUMBER,
travelAgentID NUMBER,
2019-08-27 02:45:32 +00:00
travelDate DATE,
CONSTRAINT Reservation_pk PRIMARY KEY(reservationID)
2019-08-27 02:06:41 +00:00
);
CREATE SEQUENCE reservationID_seq;
2019-08-27 02:06:41 +00:00
CREATE TABLE Customer(
customerID NUMBER,
firstName VARCHAR2(15),
lastName VARCHAR2(15),
address VARCHAR2(30),
2019-08-27 02:45:32 +00:00
phone NUMBER(10),
2019-08-27 02:54:49 +00:00
CONSTRAINT Customer_pk PRIMARY KEY(customerID),
CONSTRAINT Customer_U1 UNIQUE(firstName, lastName, phone),
CONSTRAINT Customer_phoneNumber_Val CHECK (phone IS NOT NULL)
2019-08-27 02:06:41 +00:00
);
CREATE SEQUENCE customerID_seq;
2019-08-27 02:06:41 +00:00
CREATE TABLE Cruise(
cruiseID NUMBER,
cruiseName VARCHAR2(25),
departurePort VARCHAR2(20),
days NUMBER(2),
companyName VARCHAR2(15),
shipName VARCHAR2(30),
2019-08-27 02:45:32 +00:00
price NUMBER(7, 2),
CONSTRAINT Cruise_pk PRIMARY KEY(cruiseID)
2019-08-27 02:06:41 +00:00
);
CREATE SEQUENCE cruiseID_seq;
2019-08-27 02:06:41 +00:00
CREATE TABLE TravelAgent(
travelAgentID NUMBER,
firstName VARCHAR2(15),
lastName VARCHAR2(20),
title VARCHAR2(15),
2019-08-27 02:45:32 +00:00
salary NUMBER(7, 2),
CONSTRAINT TravelAgent_pk PRIMARY KEY(travelAgentID)
2019-08-27 02:06:41 +00:00
);
CREATE SEQUENCE travelAgentID_seq;
2019-08-27 02:06:41 +00:00
CREATE TABLE Company(
companyName VARCHAR2(15),
stockSymbol CHAR(4),
2019-08-27 02:45:32 +00:00
website VARCHAR2(40),
CONSTRAINT Company_pk PRIMARY KEY(companyName),
CONSTRAINT Company_stockSymbol_U UNIQUE(stockSymbol)
2019-08-27 02:06:41 +00:00
);