5.1) For each of the following statements, show whether the statement is correctly executed or not (assume that the statements are executed in order, which means that if a statement is correctly executed, its effect is reflected in the following statement). If you say the statement is not executed, explain why.
Consider the following
Table name: Students Primary key: sid
Sid |
sname |
7 |
Ricky |
2 |
Ellen |
6 |
MaryLou |
4 |
Ellen |
Table name: Courses Primary key: cid
cid |
cname |
1 |
ICS |
2 |
Finance |
Table name: Register Primary key: sid,cid
Foreign key: sid references Students(sid)
Foreign key: cid references Courses(cid)
sid |
cid |
7 |
2 |
2 |
2 |
7 |
1 |
4 |
1 |
5.1) For each of the following statements, show whether the statement is correctly executed or not (assume that the statements are executed in order, which means that if a statement is correctly executed, its effect is reflected in the following statement). If you say the statement is not executed, explain why.
- INSERT INTO Students VALUES (3, ‘Ellen’);
- INSERT INTO Students VALUES (6, ‘Ellen’);
- INSERT INTO Register VALUES (1, 2);
- INSERT INTO Courses VALUES (5, ‘Systems’);
- INSERT INTO Register VALUES (6, 5);
- INSERT INTO Register VALUES (3, 5);
5.2) Show the output of each of the following queries. Assume that the queries are executed after executing the previous INSERT statements:
- SELECT *
FROM Students;
- SELECT S.sname, C.cname
FROM Students S, Courses C, Register R
WHERE R.sid = S.sid and R.cid = C.cid
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images