Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Based on the given table Stocks choose the possible output if the following s

ID: 3906220 • Letter: 1

Question

1.

Based on the given table Stocks choose the possible output if the following sql statement is executed.

SELECT COUNT(PRICE) FROM STOCKS;

Select one:

a. 1

b. 0

c. 2

d. 3

2.

SELECT MAX(NAME) FROM STOCKS;

Select one:

a. SUNSILK

b. SODA

c. TIDE

d. ZONROX

3.

SELECT MIN(PRICE) FROM STOCKS;

Select one:

a. 4

b. 5

c. 7

d. 6

4.

SELECT AVG(NVL(QTY,0)) FROM STOCKS;

Select one:

a. 8

b. 0.8

c. 8.22

d. 0

5.

SELECT AVG(WAREHOUSE) FROM STOCKS;

Select one:

a. 2

b. 1

c. 5

d. 3

Table Name -Stocks ID NAME WAREHOUSE CL QTY PRICE 50 27 35 1 SS 3 PL 5 ZR 5 TD 10 KF 7 SG 8 ZR 5 TD 1 SUNSILK 2 PALMOLIVE 10 ZONROX 12 TIDE 9 KING FLOUR 4 SAFEGUARD 5 ZONRO)X 7 TIDE 8 SODA 7 7

Explanation / Answer

1. SELECT COUNT(PRICE) FROM STOCKS;

(d) 3 since 3 values are present.

2. SELECT MAX(NAME) FROM STOCKS;

(d) ZONROX since Z is alphabetically largest

3. SELECT MIN(PRICE) FROM STOCKS;

(c) 7 since 7 is minimum

4. SELECT AVG(NVL(QTY,0)) FROM STOCKS;

(c) NVL will replace null values with 0. therefore, avg = (50+5+1+0+5+7+1+0+5)/9 = 8.22 option(c)

5. SELECT AVG(WAREHOUSE) FROM STOCKS;

(c) 5 since avg = sum/n = (1+2+10+12+9+4+5+7+8)/9 = 45/9 = 5