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;

6 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. 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.

    ReplyDelete
    Replies
    1. We have to count distinct number of stores.

      Delete
  2. I think he is right because in question it is written that we have to count total number of stores in the sales table

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post