CST8215 SQL Queries and Statements Final
Exam| Questions and Answers Latest
Updated (Graded A+)
• Based on the following query, which statement is true (this is a Canadian postal code stored with a
space)?
SELECT * FROM customers where postal_code LIKE 'K 2%';
a. It will retrieve all customers whose postal code contains the number 2 regardless of position.
b. It will retrieve all customers whose postal code does not contain K and 2.
c. It will retrieve all customers whose postal code starts with K.
d. It will retrieve all customers whose postal code starts with K and contains the number 2 in 5th
position.
• When sorting the results of a query, can you sort by multiple columns?
a. Yes, by separating the sort columns with a space.
b. Yes, by separating the sort columns with a comma
c. No, you can only sort by a single column
• Based on the following query, which statement is true?
SELECT * FROM emp WHERE ename LIKE 'ad%' AND deptno = 1;
a. The query will retrieve only employees with an ename that starts with "ad" and deptno = 1
b. The query will retrieve only employees with an ename that starts with "ad"
c. The query will retrieve only employees with an ename that starts with "ad" and deptno is not null
d. The query will retrieve only employees with an enamethat contains "ad" anywhere and deptno =
1
• Based on the following query, which statement is true?
o SELECT SUM(line_total), order_id FROM order_lines GROUP BY order_id HAVING
sum(line_total) > 1000.00
o It will retrieve all order_id values for orders whose total exceeds 1000.00
o It will retrieve all order_id values for orders whose total is not 1000.00
o It will retrieve all order_id values for orders whose total is equal to 1000.00
o It will retrieve all order_id values for orders whose total is less than 1000.00
• A sequential group of statements that should be performed as a single unit of work to be
committed or rolled back is called a:
o Business rule
o Join
o Transaction
o Data entry
Exam| Questions and Answers Latest
Updated (Graded A+)
• Based on the following query, which statement is true (this is a Canadian postal code stored with a
space)?
SELECT * FROM customers where postal_code LIKE 'K 2%';
a. It will retrieve all customers whose postal code contains the number 2 regardless of position.
b. It will retrieve all customers whose postal code does not contain K and 2.
c. It will retrieve all customers whose postal code starts with K.
d. It will retrieve all customers whose postal code starts with K and contains the number 2 in 5th
position.
• When sorting the results of a query, can you sort by multiple columns?
a. Yes, by separating the sort columns with a space.
b. Yes, by separating the sort columns with a comma
c. No, you can only sort by a single column
• Based on the following query, which statement is true?
SELECT * FROM emp WHERE ename LIKE 'ad%' AND deptno = 1;
a. The query will retrieve only employees with an ename that starts with "ad" and deptno = 1
b. The query will retrieve only employees with an ename that starts with "ad"
c. The query will retrieve only employees with an ename that starts with "ad" and deptno is not null
d. The query will retrieve only employees with an enamethat contains "ad" anywhere and deptno =
1
• Based on the following query, which statement is true?
o SELECT SUM(line_total), order_id FROM order_lines GROUP BY order_id HAVING
sum(line_total) > 1000.00
o It will retrieve all order_id values for orders whose total exceeds 1000.00
o It will retrieve all order_id values for orders whose total is not 1000.00
o It will retrieve all order_id values for orders whose total is equal to 1000.00
o It will retrieve all order_id values for orders whose total is less than 1000.00
• A sequential group of statements that should be performed as a single unit of work to be
committed or rolled back is called a:
o Business rule
o Join
o Transaction
o Data entry