------------
---TABLES---
------------
CREATE TABLE Customer
(
id INTEGER NOT NULL,
fname CHAR(32) NOT NULL,
lname CHAR(32) NOT NULL,
phone CHAR(13) NOT NULL,
address CHAR(256) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE Mechanic
(
id INTEGER NOT NULL,
fname CHAR(32) NOT NULL,
lname CHAR(32) NOT NULL,
experience _YEARS NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE Car
(
vin VARCHAR(16) NOT NULL,
make VARCHAR(32) NOT NULL,
model VARCHAR(32) NOT NULL,
year _YEAR NOT NULL,
PRIMARY KEY (vin)
);
---------------
---RELATIONS---
---------------
CREATE TABLE Owns
(
ownership_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
car_vin VARCHAR(16) NOT NULL,
PRIMARY KEY (ownership_id),
FOREIGN KEY (customer_id) REFERENCES Customer(id),
FOREIGN KEY (car_vin) REFERENCES Car(vin)
);
CREATE TABLE Service_Request
(
rid INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
car_vin VARCHAR(16) NOT NULL,
date DATE NOT NULL,
odometer _PINTEGER NOT NULL,
complain TEXT,
PRIMARY KEY (rid),
FOREIGN KEY (customer_id) REFERENCES Customer(id),
FOREIGN KEY (car_vin) REFERENCES Car(vin)
);
CREATE TABLE Closed_Request
(
wid INTEGER NOT NULL,
rid INTEGER NOT NULL,
mid INTEGER NOT NULL,
date DATE NOT NULL,
comment TEXT,
bill _PINTEGER NOT NULL,
PRIMARY KEY (wid),
FOREIGN KEY (rid) REFERENCES Service_Request(rid),
FOREIGN KEY (mid) REFERENCES Mechanic(id)
);
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
giathuan123/cs166-project
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published