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

The following questions are based on the tables ‘test1’: select * from test1; tt

ID: 3597052 • Letter: T

Question

The following questions are based on the tables ‘test1’:

select * from test1;

tt     |           discount           

------------------------------------

   14 |           0.00                

9999             |                       0.00                

   10 |           22.22              

   11 |           0.00                

   null |           11.00              

(5 rows)

Write down the results of executing the following

1) select count(*) from test1;

2) select count(tt) from test1;

3) select count(distinct discount) from test1;

4) select avg(tt) from test1;

5) select avg(distinct discount) from test1;

6) select * from test1 t1 natural inner join test1 t2;

Explanation / Answer

1) 5

2) 5

3) 3

4) 206.8

5) 11.733

6)

t1.tt     | t1.discount t2.tt | t2.discount

----------------------------------------------------------------------------

   14 |           0.00 14 |           0.00

9999 | 0.00   14 |           0.00

   10 |           22.22 14 |           0.00

   11 |           0.00 14 |           0.00

   null |           11.00   14 |           0.00

14 |           0.00 9999 | 0.00

9999 | 0.00    9999 | 0.00

   10 |           22.22 9999 | 0.00

   11 |           0.00 9999 | 0.00

   null |           11.00    9999 | 0.00

14 |           0.00      10 |           22.22

9999 | 0.00      10 |           22.22

   10 |           22.22      10 |           22.22

   11 |           0.00      10 |           22.22

   null |           11.00      10 |           22.22

14 |           0.00 11 |           0.00

9999 | 0.00 11 |           0.00

   10 |           22.22 11 |           0.00

   11 |           0.00 11 |           0.00

   null |           11.00 11 |           0.00

14 |           0.00 null |           11.00  

9999 | 0.00 null |           11.00  

   10 |           22.22 null |           11.00  

   11 |           0.00 null |           11.00  

   null |           11.00 null |           11.00