In: Computer Science
You have decided to build the database for John’s
system. This question centres around the
development of John’s database.
Q.3.1 Draw any three tables you will include in John’s database.
For each table,
provide the following:
a. Three fields.
b. One record in each table.
c. One primary key for each table.
d. One foreign key.
(20)
Q.3.2 Design a logical view for the tables you have specified in
Q.3.1.
Note: You may use any software tool to create your view.
Business Information System
CREATE database John;
use John;
CREATE table vehicle(
vic_num varchar(30) not NULL,
Lic_plate varchar(7) not NULL,
Make varchar(13) not null,
PRIMARY KEY(vic_num)
);
CREATE table Person(
Id_num numeric(8) not NULL,
Name varchar(124) not NULL,
vic_num varchar(30) not NULL,
FOREIGN KEY (vic_num) REFERENCES
vehicle(vic_num),
PRIMARY KEY (Id_num)
);
CREATE table parking(
vic_num varchar(30) not NULL,
Pnumber varchar(10) not NULL,
Pname varchar(20) not NULL,
PRIMARY KEY(Pnumber),
FOREIGN KEY (vic_num) REFERENCES
vehicle(vic_num)
);
INSERT INTO Vehicle (vic_num, Lic_plate,Make)
VALUES ('00LK64', '001A', 'Japan');
INSERT INTO Person (Id_num, Name, vic_num)
VALUES ('0221232', 'ABUL', '00LK64');
INSERT INTO parking (Pnumber, Pname, vic_num)
VALUES ('022', 'LUANDA', '00LK64');
Output:
_________________________________
Comment Down For Any Queries.
Please Give a Thumbs Up If You are satisfied With The Answer.