70 likes | 156 Views
Advanced Query Formulation with SQL. Week 10 Quiz Jaymond Huynh Tim Nguyen. Question 1. Which type of join should be used to include no-matching tuples from both tables in the results? Answer: D. A Full-Outer Join should be used to include no-matching tuples from both tables. . Question 2.
E N D
Advanced Query Formulation with SQL Week 10 Quiz Jaymond Huynh Tim Nguyen
Question 1 Which type of join should be used to include no-matching tuples from both tables in the results? Answer: D. A Full-Outer Join should be used to include no-matching tuples from both tables.
Question 2 Which clauses the SELECT statement can have nested queries: Answer: D. All of the above Nested queries can appear in FROM, WHERE, and HAVING clauses. A nested query typically appears as part of a condition in the WHERE and HAVING clauses. However, nested queries can also be used in the FROM clause.
Question 3 Which relational operation is very difficult to represent in SQL without nested queries Answer: C. Division Sql has no direct relational division operator. The only way to get around this is the have nested queries.
Question 4 Type II nested queries are not used for join problems because: Answer: A. Repeated executions make them inefficient for this purpose A Type II nested query executes one time for each row in the outer query.
Question 5 How many rows are there in the “student” table, if “select count(name) from student where gpa > 3” returns the number M and “select count(*) from student where gpa <= 3” returns the number N: Answer: B. >=M+N gpa > 3 will return the exclusive gpa”s without 3 and eh gpa <=3 will include 3 and all other gpas lower than 3. However, count(name) will only includes values that are not NULL. Not including NULL values will not show the number of rows, but the number of rows that are not NULL.
Question 6 Explain a situation when a full outer join is useful A full outer join can be useful to see relations between all entities. For instance, using a full outer join on two table allows the DBA to see relations between the two tables.