Uploaded by Assylkhan Berikbolov

lab 1 DBMS

advertisement
CREATE TABLE Customers (
cust_id INT PRIMARY KEY,
account_id INT REFERENCES Accounts(account_id),
name INT NOT NULL,
age VARCHAR NOT NULL,
gender INT NOT NULL,
contact_number VARCHAR NOT NULL,
address INT NOT NULL
);
CREATE TABLE Transactions (
trans_id INT PRIMARY KEY,
trans_date INT NOT NULL,
cust_id INT REFERENCES Customers(cust_id),
crew_id INT REFERENCES Crew(crew_id),
pay_id INT REFERENCES Payment(pay_id),
reservation_id INT REFERENCES Reservation(reservation_id)
);
CREATE TABLE Payment (
pay_id INT PRIMARY KEY,
cust_id INT REFERENCES Customers(cust_id),
method INT NOT NULL,
amount VARCHAR NOT NULL,
date INT NOT NULL
);
CREATE TABLE Accounts (
account_id INT PRIMARY KEY,
type INT NOT NULL,
username INT NOT NULL,
password INT NOT NULL
);
CREATE TABLE Crew (
crew_id INT PRIMARY KEY,
account_id INT REFERENCES Accounts(account_id),
name INT NOT NULL,
job_title INT NOT NULL,
assignment INT NOT NULL,
details INT NOT NULL
);
CREATE TABLE Reservation (
reservation_id INT PRIMARY KEY,
crew_id INT REFERENCES Crew(crew_id),
cust_id INT REFERENCES Customers(cust_id),
room_id INT REFERENCES Rooms(room_id),
date INT NOT NULL,
date_in INT NOT NULL,
date_out INT NOT NULL,
total_payment INT NOT NULL
);
CREATE TABLE Roomtype (
type_id INT PRIMARY KEY,
name INT NOT NULL,
description INT NOT NULL
);
CREATE TABLE Rooms (
room_id INT PRIMARY KEY,
type_id INT REFERENCES Roomtype(type_id),
name INT NOT NULL,
description INT NOT NULL,
price INT NOT NULL,
status INT NOT NULL
);
Download