Answer to Question #280763 in Databases | SQL | Oracle | MS Access for swsq

Question #280763

Get the number of male and female premium users in the platform.

As mentioned above, We need to count the users who has the premium membership, but you are trying to sum instead of count(). And also in the WHERE clause, we need to check premium users have premium_membership value as 1 , and the value 0 is considered as non-premium user.

Table: USER

user_id name gender age country premium_membership

2000 John White M 63 AUSTRALIA 1

2001 John Andrews M 67 AUSTRALIA 1

2002 April Robinson F 60 SRILANKA 1

2003 Kathy Ryan F 81 SRILANKA 0

2004 Megan Bradshaw F 53 AUSTRALIA 1

2005 Melissa Sullivan F 45 BANGLADESH 1

there is still having lot of data in the table, but I just gave the limited data for example to get the solution related to question and the expected output format should be as follows:

Table: gender total_users

F ...

M ...



1
Expert's answer
2021-12-17T06:51:39-0500
SELECT COUNT(*) 
FROM USER
WHERE premium_membership = 1

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS