--学生表
create table t_student
(
id number,
name varchar2(100),
sex number
)
;
-- Add comments to the columns
comment on column t_student.id
is 'id';
comment on column t_student.name
is '姓名';
comment on column t_student.sex
is '性别0:男 1:女';
--查询男、女生的数量
--count(1),算在总数内。
--count(null),不算在总数内。
select count(decode(sex, 0, 1, null)) boyNum,
count(decode(sex, 1, 1, null)) girlNum
from t_studentOracle-count加条件计算
最新推荐文章于 2024-06-07 00:02:45 发布
本文介绍了一个简单的学生信息表的创建方法,并展示了如何通过SQL语句来查询不同性别的学生数量。
1244

被折叠的 条评论
为什么被折叠?



