create table data
(
name varchar(50),
gender char(1)
);
insert into data values('sukrisno','M');
insert into data values('johny','M');
insert into data values('wardati','F');
select gender, count(name) from data group by gender;
select
sum(if(gender='M',1,0)) AS 'M',
sum(if(gender='F',1,0)) AS 'F'
from data
No comments:
Post a Comment