Database Programming Section 8 Quiz
Database Programming Section 8 Quiz
Section 8 Quiz
(Answer all questions in this section)
MEAN
AVERAGE
AVG (*)
MEDIAN
[Correct] Correct
2. Which group function would you use to display the average
price of all products in the PRODUCTS table? Mark for Review
(1) Points
SUM
COUNT
AVG (*)
MAX
[Correct] Correct
CUSTOMER_ID NUMBER(9)
FIRST_NAME VARCHAR2(25)
LAST_NAME VARCHAR2(30)
CREDIT_LIMIT NUMBER (7,2)
CATEGORY VARCHAR2(20)
You need to calculate the average credit limit for all the customers in
each category. The average should be calculated based on all the
rows in the table excluding any customers who have not yet been
assigned a credit limit value.
Which group function should you use to calculate this value?
Mark for Review
(1) Points
STDDEV
SUM
COUNT
AVG (*)
[Correct] Correct
True
False (*)
[Correct] Correct
True (*)
False
[Correct] Correct
(Answer all questions in this section)
TRUCKS:
TYPE VARCHAR2(30)
YEAR DATE
MODEL VARCHAR2(20)
PRICE NUMBER(10)
Which SELECT statement will return the average price for the 4x4
model?
Mark for Review
(1) Points
SELECT AVG(price)
FROM trucks
WHERE model IS '4x4';
SELECT AVG(price)
FROM trucks
WHERE model IS 4x4;
SELECT AVG(price)
FROM trucks
WHERE model = '4x4';
(*)
[Correct] Correct
COUNT
MIN
AVG
MAX (*)
[Correct] Correct
SELECT AVG(commission_pct)
FROM employees
WHERE employee_id IN( 143,144,149,174,176,178);
Mark for Review
(1) Points
0.0425
0.2125 (*)
1.2125
SELECT COUNT(*)
FROM products;
SELECT COUNT(*)
FROM employees;
SELECT COUNT(commission_pct)
FROM employees;
Mark for Review
(1) Points
Yes
No (*)
[Correct] Correct
(Answer all questions in this section)
SELECT COUNT(products);
[Correct] Correct
The statement will return the total number of rows in the AMOUNT
column.
The statement will replace all NULL values that exist in the
AMOUNT column.
[Correct] Correct
[Correct] Correct
SELECT COUNT(category)
FROM styles;
7 (*)
6
The statement will NOT execute successfully.
[Correct] Correct
EMPLOYEE_ID NUMBER(9)
LAST_NAME VARCHAR2(20)
FIRST_NAME VARCHAR2(20)
SALARY NUMBER(7,2)
DEPARTMENT_ID NUMBER(9)
SELECT COUNT(*)
FROM employees
WHERE salary > 50000
GROUP BY employee_id, last_name, first_name, salary,
department_id;
SELECT COUNT(*)
FROM employees
WHERE salary < 50000;
SELECT COUNT(*)
FROM employees
WHERE salary > 50000;
(*)
[Correct] Correct