15 which of the following sql statements deletes all

This preview shows page 11 - 15 out of 31 pages.

15. Which of the following SQL statements deletes all the data from a table Lecturer , including the table itself. (a) DROP Lecturer; (b) DELETE * FROM Lecturer; (c) DELETE FROM Lecturer; (d) DROP TABLE Lecturer; (e) DELETE Lecturer; lOMoARcPSD|2860748
SEE OVER Distributing prohibited | Downloaded by Jia Li ([email protected])
Semester 2 Supplementary/Deferred Examinations February 2016 11. CITS1402 16. Consider a relation R ( A, B, C, D ) with the following rows. A B C D 1 3 2 2 2 3 2 4 3 3 3 6 3 1 1 6 Which of the following decompositions into two relations R 1 and R 2 is lossless- join , for this particular instance? lOMoARcPSD|2860748
17. Which SQL keyword is most similar to the relational algebra rename operator ρ ?
(e) WITH SEE OVER Distributing prohibited | Downloaded by Jia Li ([email protected])
Semester 2 Supplementary/Deferred Examinations February 2016 12. CITS1402 18. In a database there is a trade-off between isolation levels and performance, be- cause stronger isolation reduces the ability of the system to interleave statements from different transactions. Which of the following lists the possible isolation lev- els in increasing isolation strength (and thus decreasing performance potential)? lOMoARcPSD|2860748
19. Suppose that a table T ( A, B, C ) contains the following tuples: (1 , 1 , 3), (1 , 2 , 3), (2 , 1 , 4), (2 , 3 , 5), (2 , 4 , 1), (3 , 2 , 4) and consider the following view definition: CREATE VIEW V AS SELECT A+B AS D, C FROM T; Consider the following query over the view V SELECT D, SUM(C) FROM V GROUP BY D HAVING COUNT(*) <> 1; Which of the following tuples is in the output? (a) (2 , 3) (b) (1 , 8) (c) (6 , 7) (d) (3 , 5) (e) (5 , 9)
SEE OVER Distributing prohibited | Downloaded by Jia Li ([email protected])
Semester 2 Supplementary/Deferred Examinations February 2016 13. CITS1402 20. Suppose that a university has a database containing two tables created as follows: CREATE TABLE Student (id INT, name VARCHAR(64)); CREATE TABLE Enrolled (sid INT, uid INT); The field Student.id is the student number, and Enrolled.sid is a foreign key to this field, while Enrolled.uid is the unique code for a unit. What does the following query produce? SELECT S.id, COUNT(E.uid) FROM Student S LEFT OUTER JOIN Enrolled E ON S.id = E.sid GROUP BY S.id (a) It produces a list of all the enrolments, listed by student number and unit code (b) It produces a list of the number of enrolments for each student that is enrolled in at least one unit (c) It produces a list of the number of enrolments for each student in the Student table, including students not enrolled in any units, for which the number is given as NULL (d) It produces a list of the number of enrolments for each student in the Student

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture