3 if the relation r from question 1 were implemented

This preview shows page 5 - 10 out of 31 pages.

3. If the relationRfrom Question 1 were implemented as a MySQL table, then howmany rows would the following query produce?SELECT * FROM(SELECT A,B FROM R) AS T1NATURAL JOIN(SELECT B,C FROM R) AS T2;(a) 0(b) 2(c) 4(d) 5(e) 9lOMoARcPSD|2860748
4. Consider a relationR(A, B, C, D, E) with functional dependenciesAB, ABC, DABCEand consider three possible sets of attributes, namelyA,ABandCD.Which of the three are keys (not necessarily minimal) for the relationR?
SEE OVERDistributing prohibited | Downloaded by Jia Li ([email protected])
Semester 2 Supplementary/Deferred ExaminationsFebruary 20165.CITS14025. Consider the followingSQLtableMarksthat stores some students’ overall CS andMaths marks, and currently has the following contents:namecsMark mathMarkAmy50NULLBillNULL80Christine8065David6065Which students’ names will appear in the result of the following query:SELECT nameFROM MarksWHERE (csMark < (SELECT AVG(mathMark) FROM Marks));lOMoARcPSD|2860748
6. Which SQL keyword has the same effect as theselectionoperatorσof relationalalgebra.
Distributing prohibited | Downloaded by Jia Li ([email protected])
Semester 2 Supplementary/Deferred ExaminationsFebruary 20166.CITS14027. Consider the relationsR(A, B) andS(B, C) which currently have the followingdataAB121334BC252678How many rows will be returned from the following MySQL query?SELECT *FROM R NATURAL LEFT OUTER JOIN S;(a) 2(b) 4(c) 6(d) 5(e) 3lOMoARcPSD|2860748
8. Suppose that a SQL tableData(A,B)contains 3 tuples (not necessarily distinct)and that none of the entries areNULL.If the following query is madeSELECT D1.A, D1.B, D2.A, D2.BFROM Data D1, Data D2WHERE D1.A = D2.A and D1.B = D2.Bthen how many tuples will be in the result? (Choose the most precise answer)
SEE OVERDistributing prohibited | Downloaded by Jia Li ([email protected])
Semester 2 Supplementary/Deferred ExaminationsFebruary 20167.CITS14029. Consider a database used by a home loan provider that contains two relations:Customer(name, mortgage_id)Mortgage(mortgage_id, amount)and a view is defined asCREATE VIEW mortgage_info ASSELECT name, amountFROM Customer JOIN Mortgage USING (mortgage_id);If the tables are initially empty, then which of the following sequences of state-ments creates a new tuple accessible by using the view?I.INSERT INTO Customer VALUES("Smith", 10118);INSERT INTO Mortgage VALUES(10118, NULL);II.INSERT INTO Customer VALUES("Smith", NULL);INSERT INTO Mortgage VALUES(NULL, 500000);III.INSERT INTO Customer VALUES("Smith", 10118);INSERT INTO Mortgage VALUES(10118, 500000);lOMoARcPSD|2860748
SEE OVERDistributing prohibited | Downloaded by Jia Li ([email protected])
Semester 2 Supplementary/Deferred ExaminationsFebruary 20168.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 31 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
One
Professor
N/A
Tags
Jia Li

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture