Q. Which SQL statement lets you find the total number of stores in the SALES table?
(a) SELECT COUNT (STORE_ID) FROM SALES;
(b) SELECT COUNT (DISTINCT STORE_ID) FROM SALES;
(c) SELECT DISTINCT STORE_ID FROM SALES;
(d) SELECT COUNT (STORE_ID) FROM SALES GROUP BY STORE_ID;
Consider this table --
You can understand by seeing this video ---
Answer =
(b) SELECT COUNT (DISTINCT STORE_ID) FROM SALES;
I think the answer is B. It is asking for total number of stores. Your answer would give the number of occurences of each store in the table, which is not what is asked.
ReplyDeleteWe have to count distinct number of stores.
DeleteI think he is right because in question it is written that we have to count total number of stores in the sales table
ReplyDeleteSorry, I have corrected it.
Deletei do no
ReplyDeleteWhat ??
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )