Quiz 4 Flashcards

1
Q

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)

A

b. _ (underscore)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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’];

A

c. SELECT *
FROM EMPLOYEE
WHERE Name LIKE ‘S%’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

a. SELECT AVG (Balance)
FROM CUSTOMER
GROUP BY SalesRepNo;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

A

d. subquery

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly