站内搜索: 请输入搜索关键词
当前页面: 图书首页 > MySQL Tutorial

MySQL Tutorial

[ Directory ] Previous Section Next Section

Quiz

1:

A Cartesian product

  1. represents all possible combinations of rows in two or more tables

  2. represents the combinations of matching rows from two or more tables

  3. represents the rows from one table matched with rows from a second table; where this is not possible, the result row is filled with NULLs where the data from the second table would have been

  4. none of the above

2:

A left join

  1. represents all possible combinations of rows in two or more tables

  2. represents the combinations of matching rows from two or more tables

  3. represents the rows from one table matched with rows from a second table; where this is not possible, the result row is filled with NULLs where the data from the second table would have been

  4. none of the above

3:

An equijoin:

  1. represents all possible combinations of rows in two or more tables

  2. represents the combinations of matching rows from two or more tables

  3. represents the rows from one table matched with rows from a second table; where this is not possible, the result row is filled with NULLs where the data from the second table would have been

  4. none of the above

4:

A correlated subquery is called this because

  1. it correlates rows between tables

  2. it correlates rows in a single table

  3. it correlates two joins

  4. it correlates the rows in an outer query with rows in an inner query

5:

The difference between the two queries marked 5.1 and 5.2 in the following text is that

  1. there is no difference

  2. they return different data

  3. they return the same data but the left join (Query 5.1) is likely to execute faster

  4. they return the same data but the subquery (Query 5.2) is likely to execute faster

Query 5.1:


select employee.name
from employee left join assignment
on employee.employeeID = assignment.employeeID
where clientID is null;

Query 5.2:


select e.name, e.employeeID
from employee e
where not exists
          (select *
           from assignment
           where employeeID = e.employeeID);


    [ Directory ] Previous Section Next Section