Last answered:

11 May 2023

Posted on:

08 Oct 2021

3

Missing AS in mock interview 3

After the percent closed is found, you didn't use the AS keyword to name the column.  That gives an error when running the query.

Also, you can compute the denominator in the expression instead of the closed + open, just counting all accounts.  Since the interviewer specified that each account must have a status, you can count the status only.

(count(case when status = 'closed' then 1 else null end) * 1.00)/
(count(status)) * 100 as perc_closed

1 answers ( 0 marked as helpful)
Posted on:

11 May 2023

0

1. It is not necessary to write AS

 

2. your argument is true about the COUNT(status) 

Submit an answer