Design a database with the following tables
Table name: Customer
customer_id |
lastname |
firstname |
phone |
c10001 |
Smith |
John |
714-877-2333 |
Table name: Video
video_id |
title |
daily_rent |
V8752 |
ET |
2.99 |
Table name: Transaction
transaction_id |
customer_id |
video_id |
date_rented |
Please create 3 tables and enter 5 records in each table using WORD
Please indicate the primary key and foreign keys of each table
Dear Student ,
As per requirement submitted above kindly find below solution.
This demonstration is using MySQL.
1.Table Name :Customer
create table Customer(
customer_id varchar(10) primary key,
lastname varchar(50),
firstname varchar(50),
phone varchar(50));
/*inserting records*/
insert into customer values
('c10001','Smith','John','714-877-2333');
insert into customer values
('c10002','Sam','Karan','714-888-2434');
insert into customer values
('c10003','Ram','Kill','714-887-2933');
insert into customer values
('c10004','Pink','Blue','714-977-25334');
insert into customer values
('c10005','Virat','Kohli','715-777-3333');
insert into customer values
('c10006','KL','Rahul','715-778-2333');
/*selecting records from customer table*/
select * from customer;
Screen in MySQL :
**************************************
2.Table Name
:Video
create table Video(
video_id varchar(10) primary key,
title varchar(50),
daily_rent decimal(6,2));
/*inserting records*/
insert into Video values ('V8752','ET',2.99);
insert into Video values ('V8753','ET1',3.99);
insert into Video values ('V8754','AT2',4.99);
insert into Video values ('V8755','QP3',5.99);
insert into Video values ('V8756','BS',6.99);
insert into Video values ('V8757','MQV',7.99);
/*selecting records from Video table*/
select * from Video;
Screen in MySQL :
********************************
3.Table Name
:Transaction
create table Transaction(
transaction_id varchar(10) primary key,
customer_id varchar(10),
video_id varchar(10) ,
date_rented date,
foreign key (customer_id) references customer(customer_id),
foreign key (video_id) references video(video_id));
/*inserting records*/
insert into Transaction values
('T001','c10001','V8752','2020/06/04');
insert into Transaction values
('T002','c10001','V8753','2020/07/01');
insert into Transaction values
('T003','c10002','V8754','2020/05/04');
insert into Transaction values
('T004','c1003','V8755','2020/06/24');
insert into Transaction values
('T005','c1004','V8756','2020/07/05');
/*selecting records from Transaction table*/
select * from Transaction;
Screen in MySQL :
NOTE :PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
Get Answers For Free
Most questions answered within 1 hours.