COMPUTER CONCEPTS MODULE 7
EXAMPREP QUESTIONS AND SOLUTIONS
COMPLETE PREPARATION SHEET
●● In which type of join are all rows from the table listed first in the
query included, regardless of whether they match rows from the table
listed second in the query?
Answer: left outer join
●● In which type of join will all rows from the table listed second in the
query be included regardless of whether they match rows from the table
listed first in the query?
Answer: right outer join
●● A condition is true if it satisfies any value (one or more) produced by
a subquery that is preceded by the _____.
Answer: ANY operator
●● To retrieve data from multiple tables in a query, you can use a
subquery containing the _____.
Answer: IN operator
,●● The _____ of two tables is a table containing every row that is in
either the first table, the second table, or both tables.
Answer: union
●● A condition is true only if it satisfies all values produced by a
subquery when that subquery is preceded by which operator?
Answer: ALL
●● When is it necessary to qualify a column name while joining tables
in MySQL?
Answer: It is necessary when the tables have identical column names.
●● When tables are listed in the FROM clause of an SQL query, you can
give them alternate names, also known as _____.
Answer: aliases
●● The _____ of two tables is a table containing all rows that are in both
tables.
Answer: intersection
●● What is the term for the letter S or the letter D in the following
query?
,SELECT S.SERVER_ID, S.LAST_NAME, D.DINER_ID,
D.LAST_NAME
FROM SERVER S, DINER D
WHERE (S.SERVER_ID = D.SERVER_ID)
Answer: alias
●● One use case for an alias is a query that joins a table to itself, known
as a(n) _____.
Answer: self-join
●● You create an alias by typing the name of the table, pressing the
_____, and then typing the name of the alias.
Answer: Spacebar
●● When using a DBMS without an optimizer, the formulation of a
query can make a difference in the speed with which the query is
executed.
Answer: True
●● When a query includes the clause FROM CLIENT A, CLIENT B,
SQL will _____.
Answer: treat it as a query of two tables, A and B
●● Which statement about table joins in SQL is true?
, Answer: SQL has no problem treating one table with two aliases as two
tables.
●● You can use the ALL and ANY operators with subqueries to produce
a single column of numbers.
Answer: True
●● Nina is writing a MySQL query to list the descriptions of items in the
CUPCAKES table, which are identified by PROD_ID values. The
ORDER_LINE table includes product and quantity information from
bakery orders, which are identified by ORDER_NUM values. What can
she add to the following query to limit the list to descriptions of
cupcakes purchased through order 342?
SELECT DESCRIPTION FROM CUPCAKES WHERE
Answer: PROD_ID IN(SELECT PROD_ID FROM ORDER_LINE
WHERE(ORDER_NUM = '342'));
●● The product of two tables is formally called the _____.
Answer: Cartesian product
●● When a subquery involves a table listed in the outer query, the
subquery is called a(n) _____.
Answer: correlated subquery
EXAMPREP QUESTIONS AND SOLUTIONS
COMPLETE PREPARATION SHEET
●● In which type of join are all rows from the table listed first in the
query included, regardless of whether they match rows from the table
listed second in the query?
Answer: left outer join
●● In which type of join will all rows from the table listed second in the
query be included regardless of whether they match rows from the table
listed first in the query?
Answer: right outer join
●● A condition is true if it satisfies any value (one or more) produced by
a subquery that is preceded by the _____.
Answer: ANY operator
●● To retrieve data from multiple tables in a query, you can use a
subquery containing the _____.
Answer: IN operator
,●● The _____ of two tables is a table containing every row that is in
either the first table, the second table, or both tables.
Answer: union
●● A condition is true only if it satisfies all values produced by a
subquery when that subquery is preceded by which operator?
Answer: ALL
●● When is it necessary to qualify a column name while joining tables
in MySQL?
Answer: It is necessary when the tables have identical column names.
●● When tables are listed in the FROM clause of an SQL query, you can
give them alternate names, also known as _____.
Answer: aliases
●● The _____ of two tables is a table containing all rows that are in both
tables.
Answer: intersection
●● What is the term for the letter S or the letter D in the following
query?
,SELECT S.SERVER_ID, S.LAST_NAME, D.DINER_ID,
D.LAST_NAME
FROM SERVER S, DINER D
WHERE (S.SERVER_ID = D.SERVER_ID)
Answer: alias
●● One use case for an alias is a query that joins a table to itself, known
as a(n) _____.
Answer: self-join
●● You create an alias by typing the name of the table, pressing the
_____, and then typing the name of the alias.
Answer: Spacebar
●● When using a DBMS without an optimizer, the formulation of a
query can make a difference in the speed with which the query is
executed.
Answer: True
●● When a query includes the clause FROM CLIENT A, CLIENT B,
SQL will _____.
Answer: treat it as a query of two tables, A and B
●● Which statement about table joins in SQL is true?
, Answer: SQL has no problem treating one table with two aliases as two
tables.
●● You can use the ALL and ANY operators with subqueries to produce
a single column of numbers.
Answer: True
●● Nina is writing a MySQL query to list the descriptions of items in the
CUPCAKES table, which are identified by PROD_ID values. The
ORDER_LINE table includes product and quantity information from
bakery orders, which are identified by ORDER_NUM values. What can
she add to the following query to limit the list to descriptions of
cupcakes purchased through order 342?
SELECT DESCRIPTION FROM CUPCAKES WHERE
Answer: PROD_ID IN(SELECT PROD_ID FROM ORDER_LINE
WHERE(ORDER_NUM = '342'));
●● The product of two tables is formally called the _____.
Answer: Cartesian product
●● When a subquery involves a table listed in the outer query, the
subquery is called a(n) _____.
Answer: correlated subquery