Quiz 4 Flashcards
In an SQL query, which of the following symbols is used by ANSI SQL to represent a single unspecified character?
a. ? (question mark)
b. _ (underscore)
c. * (asterisk)
d. % (percent)
b. _ (underscore)
Given a table with the structure: EMPLOYEE (EmpNo, Name, Salary, HireDate), which of the following would find all employees whose name begins with the letter “S”?
a. SELECT EmpNo
FROM EMPLOYEE
WHERE Name LIKE ‘S’;
b. SELECT *
FROM EMPLOYEE
WHERE Name LIKE ‘S*
c. SELECT *
FROM EMPLOYEE
WHERE Name LIKE ‘S%’;
d. SELECT *
FROM EMPLOYEE
WHERE Name IN [‘S’];
c. SELECT *
FROM EMPLOYEE
WHERE Name LIKE ‘S%’;
Based on the tables below, which of the following SQL commands would return the average customer balance grouped by SalesRepNo?
GENERAL SALES DATABASE:
SALESREP
SalesRepNo RepName HireDate
654 Jones 01/02/2005
734 Smith 02/03/2007
345 Chen 01/25/2018
434 Johnson 11/23/2004
CUSTOMER
CustNo CustName Balance SalesRepNo
9870 Winston 500 345
8590 Gonzales. 350 434
7840 Harris 800 654
4870 Miles 100 345
a.SELECT AVG (Balance)
FROM CUSTOMER
GROUP BY SalesRepNo;
b.SELECT AVG (Balance)
FROM CUSTOMER
ORDER BY SalesRepNo;
c. SELECT AVG (Balance)
FROM CUSTOMER
WHERE SalesRepNo;
d. SELECT AVG (Balance)
FROM CUSTOMER, SALESREP
WHERE SALESREP.SalesRepNo = CUSTOMER.SalesRepNo;
a. SELECT AVG (Balance)
FROM CUSTOMER
GROUP BY SalesRepNo;
When one SQL query is nested in another SQL query, this is referred to as a ________.
a. subset query
b. WHERE Query
c. join
d. subquery
d. subquery
SQL queries using subqueries still function like a single table query in the sense that columns from both the top-level query and subquery can be displayed in the query results.
True or False
False