Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Write a query to display excepted output

User_YBZOVSep 21 2022

image.pngWrite a query to display excepted output

This post has been answered by Frank Kulash on Sep 21 2022
Jump to Answer

Comments

Frank Kulash
Answer

Hi, User_YBZOV
Here's one way:

SELECT	 COUNT (CASE WHEN gender = 'M' THEN 1 END)	AS male
,	 COUNT (CASE WHEN gender = 'F' THEN 1 END)	AS female
FROM	 employee
;

If you'd care to post CREATE TABLE and INSERT statements for the samp,e data, then I could test this.
SELECT ... PIVOT is another way.

Marked as Answer by User_YBZOV · Sep 21 2022
1 - 1

Post Details

Added on Sep 21 2022
1 comment
60 views