Using MSQL ,I\'ve created two tables below about Students borrowing books from l
ID: 3941349 • Letter: U
Question
Using MSQL ,I've created two tables below about Students borrowing books from library, and Faculty also borrowing books from a library. What I need to do now is populate these tables with 20 rows each. That's what i'm stuck on. I don't know how to populate the tables! Someone please help. It can be random names or whatever, I just need to populate them... Please help! Thank you so much.
CREATE TABLE Student_Borrow(
Reservation_Code INT NOT NULL AUTO_INCREMENT,
StudentID INT,
ResourceID INT,
StaffID INT,
Date DATE,
TimeIN TIME,
TimeOut TIME,
LateFee FLOAT,
PRIMARY KEY (Reservation_Code),
FOREIGN KEY (StudentID) REFERENCES Student(StudentID),
FOREIGN KEY (ResourceID) REFERENCES Resources(ResourceID),
FOREIGN KEY (StaffID) REFERENCES Staff(StaffID)
);
set foreign_key_checks=0
CREATE TABLE Faculty_Borrow(
Reservation_Code INT NOT NULL AUTO_INCREMENT,
FacultyID INT,
ResourceID INT,
StaffID INT,
Date DATE,
TimeIN TIME,
TimeOut TIME,
LateFee FLOAT,
PRIMARY KEY (Reservation_Code),
FOREIGN KEY (FacultyID) REFERENCES Faculty(FacultyID),
FOREIGN KEY (ResourceID) REFERENCES Resources(ResourceID),
FOREIGN KEY (StaffID) REFERENCES Staff(StaffID)
);
set foreign_key_checks=0
Explanation / Answer
A. insert into Student_Borrow(StudentID,ResourceID,StaffID,Date,TimeIN,TimeOut,LateFee) values(1,1,1,'2016-11-17','08:00:00','12:00:00',100.00);
Here time is in format hh:mm:ss and date as yyyy-mm-dd
B.
insert into Faculty_Borrow(FacultyID,ResourceID,StaffID,Date,TimeIN,TimeOut,LateFee) values(1,1,1,'2016-11-17','08:00:00','12:00:00',100.00);
Here time is in format hh:mm:ss and date as yyyy-mm-dd
Like above insert statements you can have your own values as per format.
No need to include first column which is auto incremented.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.