Q = insert 5 records into your Courses_xxxx table The fid, rid, aid should not be all the same among the 5 records. The enrollment number should be less than the room size. mysql> select * from Hotel; +---------+---------------+--------+ | hotelno | hotelname | city | +---------+---------------+--------+ | ch01 | Omni Shoreham | London | | ch02 | Phoenix Park | London | | dc01 | Latham | Berlin | | fb01 | Grosvenor | London | | fb02 | Watergate | Paris | +---------+---------------+--------+ 5 rows in set (0.00 sec) mysql> select * from Room; +--------+---------+--------+-------+ | roomno | hotelno | type | price | +--------+---------+--------+-------+ | 501 | fb01 | single | 19.00 | | 601 | fb01 | double | 29.00 | | 701 | ch02 | single | 10.00 | | 701 | fb01 | family | 39.00 | | 801 | ch02 | double | 15.00 | | 901 | dc01 | single | 18.00 | | 1001 | ch01 | single | 29.99 | | 1001 | dc01 | double | 30.00 | | 1001 | fb02 | single | 58.00 | | 1101 | ch01 | family | 59.99 | | 1101 | dc01 | family | 35.00 | | 1101 | fb02 | double | 86.00 | +--------+---------+--------+-------+ 12 rows in set (0.00 sec) (cid integer auto_increment primary key, name varchar(200) unique not null, term varchar(200) not null, enrollment int not null, Fid int not null, Rid int not null, aid int not null, foreign key (Fid) REFERENCES TECH3740.Faculty(Fid) , foreign key (Rid) REFERENCES TECH3740.Rooms(Rid) , FOREIGN KEY (aid) References TECH3740.Admin(aid));
Q = insert 5 records into your Courses_xxxx table The fid, rid, aid should not be all the same among the 5 records. The enrollment number should be less than the room size.
mysql> select * from Hotel;
+---------+---------------+--------+
| hotelno | hotelname | city |
+---------+---------------+--------+
| ch01 | Omni Shoreham | London |
| ch02 | Phoenix Park | London |
| dc01 | Latham | Berlin |
| fb01 | Grosvenor | London |
| fb02 | Watergate | Paris |
+---------+---------------+--------+
5 rows in set (0.00 sec)
mysql> select * from Room;
+--------+---------+--------+-------+
| roomno | hotelno | type | price |
+--------+---------+--------+-------+
| 501 | fb01 | single | 19.00 |
| 601 | fb01 | double | 29.00 |
| 701 | ch02 | single | 10.00 |
| 701 | fb01 | family | 39.00 |
| 801 | ch02 | double | 15.00 |
| 901 | dc01 | single | 18.00 |
| 1001 | ch01 | single | 29.99 |
| 1001 | dc01 | double | 30.00 |
| 1001 | fb02 | single | 58.00 |
| 1101 | ch01 | family | 59.99 |
| 1101 | dc01 | family | 35.00 |
| 1101 | fb02 | double | 86.00 |
+--------+---------+--------+-------+
12 rows in set (0.00 sec)
(cid integer auto_increment primary key,
name varchar(200) unique not null,
term varchar(200) not null,
enrollment int not null,
Fid int not null,
Rid int not null,
aid int not null,
foreign key (Fid) REFERENCES TECH3740.Faculty(Fid) ,
foreign key (Rid) REFERENCES TECH3740.Rooms(Rid) ,
FOREIGN KEY (aid) References TECH3740.Admin(aid));
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images