根据性别统计 分别有多少人~?
2023-12-14 09:32:09
/*
Navicat MySQL Data Transfer
Source Server : mysql.sqlpub.com
Source Server Version : 80033
Source Host : mysql.sqlpub.com:3306
Source Database : huangjin
Target Server Type : MYSQL
Target Server Version : 80033
File Encoding : 65001
Date: 2023-12-14 06:33:12
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for stu
-- ----------------------------
DROP TABLE IF EXISTS `stu`;
CREATE TABLE `stu` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`sex` varchar(10) DEFAULT NULL,
`score` int DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=257 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ----------------------------
-- Records of stu
-- ----------------------------
INSERT INTO `stu` VALUES ('1', '林正妍', '女', '1');
INSERT INTO `stu` VALUES ('2', ' 申燕星', '女', '90');
INSERT INTO `stu` VALUES ('3', ' 孟清懿', '女', '45');
INSERT INTO `stu` VALUES ('4', ' 殳敏慧', '女', '58');
INSERT INTO `stu` VALUES ('5', ' 慎灵凡', null, '53');
INSERT INTO `stu` VALUES ('6', ' 韩心菱', null, '89');
INSERT INTO `stu` VALUES ('7', ' 谭芝蓉', null, '86');
INSERT INTO `stu` VALUES ('8', ' 寿云亭', null, '63');
INSERT INTO `stu` VALUES ('9', ' 孙锦欣', null, '57');
INSERT INTO `stu` VALUES ('10', ' 步晨辰', null, '93');
INSERT INTO `stu` VALUES ('11', ' 公新雨', null, '97');
INSERT INTO `stu` VALUES ('12', ' 吴彤蕊', '男', '5');
INSERT INTO `stu` VALUES ('13', ' 冷初蝶', null, '31');
INSERT INTO `stu` VALUES ('14', ' 叶忆寒', null, '41');
INSERT INTO `stu` VALUES ('15', ' 熊天荷', null, '10');
INSERT INTO `stu` VALUES ('16', ' 莘雅丹', null, '27');
INSERT INTO `stu` VALUES ('17', ' 夏静恬', null, '6');
INSERT INTO `stu` VALUES ('18', ' 辛三春', null, '49');
INSERT INTO `stu` VALUES ('19', ' 阚问柳', null, '25');
INSERT INTO `stu` VALUES ('20', ' 汪歌韵', null, '78');
INSERT INTO `stu` VALUES ('21', ' 贡雨筠', null, '15');
INSERT INTO `stu` VALUES ('22', ' 扈经文', '女', '41');
INSERT INTO `stu` VALUES ('23', ' 梁皓洁', '女', '60');
INSERT INTO `stu` VALUES ('24', ' 王芷秀', null, '77');
INSERT INTO `stu` VALUES ('25', ' 盖新洁', null, '3');
INSERT INTO `stu` VALUES ('26', ' 芮诗文', '女', '83');
INSERT INTO `stu` VALUES ('27', ' 充明凝', null, '4');
INSERT INTO `stu` VALUES ('28', ' 权梓蓓', null, '73');
INSERT INTO `stu` VALUES ('29', ' 辛文丽', null, '53');
INSERT INTO `stu` VALUES ('30', ' 常晶婧', null, '45');
INSERT INTO `stu` VALUES ('31', ' 甘韶仪', null, '66');
INSERT INTO `stu` VALUES ('32', ' 家熙熙', null, '93');
INSERT INTO `stu` VALUES ('33', ' 潘桂月', null, '66');
INSERT INTO `stu` VALUES ('34', ' 晃家欣', null, '51');
INSERT INTO `stu` VALUES ('35', ' 伊梅青', '男', '56');
INSERT INTO `stu` VALUES ('36', ' 夏白莲', null, '25');
INSERT INTO `stu` VALUES ('37', ' 堵昭懿', null, '59');
INSERT INTO `stu` VALUES ('38', ' 汲星晴', null, '17');
INSERT INTO `stu` VALUES ('39', ' 邰欣可', null, '10');
INSERT INTO `stu` VALUES ('40', ' 富茹薇', null, '97');
INSERT INTO `stu` VALUES ('41', ' 唐沂秀', null, '56');
INSERT INTO `stu` VALUES ('42', ' 凌旋麴', null, '89');
INSERT INTO `stu` VALUES ('43', ' 芸英蔚', null, '75');
INSERT INTO `stu` VALUES ('44', ' 凡梦庄', null, '10');
INSERT INTO `stu` VALUES ('45', ' 芷卉冷', null, '21');
INSERT INTO `stu` VALUES ('46', ' 霞辉申', null, '77');
INSERT INTO `stu` VALUES ('47', ' 诗槐车', null, '20');
INSERT INTO `stu` VALUES ('48', ' 芳泽孔', '女', '68');
INSERT INTO `stu` VALUES ('49', ' 桜井须', null, '82');
INSERT INTO `stu` VALUES ('50', ' 怜云汤', null, '3');
INSERT INTO `stu` VALUES ('51', ' 逸云权', null, '69');
INSERT INTO `stu` VALUES ('52', ' 友儿尚', '男', '35');
INSERT INTO `stu` VALUES ('53', ' 兰芝甄', null, '69');
INSERT INTO `stu` VALUES ('54', ' 凝心逯', null, '39');
INSERT INTO `stu` VALUES ('55', ' 春梅何', null, '89');
INSERT INTO `stu` VALUES ('56', ' 碧莹景', null, '26');
INSERT INTO `stu` VALUES ('57', ' 夏彤刘', '女', '63');
INSERT INTO `stu` VALUES ('58', ' 楚冉程', '女', '36');
INSERT INTO `stu` VALUES ('59', ' 胤雅幸', null, '92');
INSERT INTO `stu` VALUES ('60', ' 暖瞳景', '女', '53');
INSERT INTO `stu` VALUES ('61', ' 平绿蒙', null, '85');
INSERT INTO `stu` VALUES ('62', ' 睿彤禄', null, '69');
INSERT INTO `stu` VALUES ('63', ' 可嘉魏', null, '86');
INSERT INTO `stu` VALUES ('64', ' 智敏禄', null, '23');
INSERT INTO `stu` VALUES ('65', ' 半烟翟', null, '57');
INSERT INTO `stu` VALUES ('66', ' 绮菱郁', null, '16');
INSERT INTO `stu` VALUES ('67', ' 芳润申', null, '9');
INSERT INTO `stu` VALUES ('68', ' 凌旋衡', null, '96');
INSERT INTO `stu` VALUES ('69', ' 雅丹彭', null, '53');
INSERT INTO `stu` VALUES ('70', ' 和平武', null, '74');
INSERT INTO `stu` VALUES ('71', ' 若淑申', null, '13');
INSERT INTO `stu` VALUES ('72', ' 怡婷扶', null, '42');
INSERT INTO `stu` VALUES ('73', ' 敏思隗', null, '69');
INSERT INTO `stu` VALUES ('74', ' 寻春羿', null, '21');
INSERT INTO `stu` VALUES ('75', ' 瑞娟权', '男', '97');
INSERT INTO `stu` VALUES ('76', ' 华采伊', null, '19');
INSERT INTO `stu` VALUES ('77', ' 灵槐庄', null, '7');
INSERT INTO `stu` VALUES ('78', ' 清漪姚', null, '76');
INSERT INTO `stu` VALUES ('79', ' 千叶逢', null, '57');
INSERT INTO `stu` VALUES ('80', ' 秀竹汪', '女', '60');
INSERT INTO `stu` VALUES ('81', ' 蕊珠姜', null, '26');
INSERT INTO `stu` VALUES ('82', ' 洛凝徐', null, '48');
INSERT INTO `stu` VALUES ('83', ' 曼香汤', null, '65');
INSERT INTO `stu` VALUES ('84', ' 紫安任', null, '78');
INSERT INTO `stu` VALUES ('85', ' 乐然苍', '女', '94');
INSERT INTO `stu` VALUES ('86', ' 思淼董', '女', '38');
INSERT INTO `stu` VALUES ('87', ' 冬亦翟', null, '5');
INSERT INTO `stu` VALUES ('88', ' 洋洋赵', null, '9');
INSERT INTO `stu` VALUES ('89', ' 玄穆王', null, '33');
INSERT INTO `stu` VALUES ('90', ' 山柏邓', '男', '37');
INSERT INTO `stu` VALUES ('91', ' 银瑶步', null, '84');
INSERT INTO `stu` VALUES ('92', ' 翠桃孔', null, '11');
INSERT INTO `stu` VALUES ('93', ' 优瑗蔚', null, '1');
INSERT INTO `stu` VALUES ('94', ' 昕昕甘', null, '70');
INSERT INTO `stu` VALUES ('95', ' 曜儿胡', null, '48');
INSERT INTO `stu` VALUES ('96', ' 菲菲越', null, '31');
INSERT INTO `stu` VALUES ('97', ' 绿蓉党', null, '10');
INSERT INTO `stu` VALUES ('98', ' 倩成宁', null, '54');
INSERT INTO `stu` VALUES ('99', ' 晨旭胡', null, '43');
INSERT INTO `stu` VALUES ('100', ' 恺玲庾', null, '50');
INSERT INTO `stu` VALUES ('101', ' 云飞薛', null, '22');
INSERT INTO `stu` VALUES ('102', ' 晓灵符', null, '60');
INSERT INTO `stu` VALUES ('103', ' 之柔钱', null, '35');
INSERT INTO `stu` VALUES ('104', ' 珠佩权', null, '91');
INSERT INTO `stu` VALUES ('105', ' 静靳梅', null, '51');
INSERT INTO `stu` VALUES ('106', ' 雪吕吉', null, '80');
INSERT INTO `stu` VALUES ('107', ' 玉曾尔', null, '47');
INSERT INTO `stu` VALUES ('108', ' 风漕荏', null, '96');
INSERT INTO `stu` VALUES ('109', ' 苒习晓', null, '40');
INSERT INTO `stu` VALUES ('110', ' 梅羿含', null, '8');
INSERT INTO `stu` VALUES ('111', ' 蕾吕秀', null, '21');
INSERT INTO `stu` VALUES ('112', ' 杰龚珍', '男', '82');
INSERT INTO `stu` VALUES ('113', ' 丽党乐', '男', '47');
INSERT INTO `stu` VALUES ('114', ' 蓉田宜', null, '89');
INSERT INTO `stu` VALUES ('115', ' 嘉刘古', '男', '3');
INSERT INTO `stu` VALUES ('116', ' 韵汤天', '男', '45');
INSERT INTO `stu` VALUES ('117', ' 恩鄂恨', null, '19');
INSERT INTO `stu` VALUES ('118', ' 蝶龙弘', null, '56');
INSERT INTO `stu` VALUES ('119', ' 雅唐思', '男', '24');
INSERT INTO `stu` VALUES ('120', ' 洁武惠', null, '50');
INSERT INTO `stu` VALUES ('121', ' 芳卢琛', '男', '78');
INSERT INTO `stu` VALUES ('122', ' 丽刘天', null, '39');
INSERT INTO `stu` VALUES ('123', ' 春富琼', '男', '61');
INSERT INTO `stu` VALUES ('124', ' 思邴念', null, '88');
INSERT INTO `stu` VALUES ('125', ' 文宦访', '男', '54');
INSERT INTO `stu` VALUES ('126', ' 卉邴锦', null, '8');
INSERT INTO `stu` VALUES ('127', ' 婷蓟格', null, '75');
INSERT INTO `stu` VALUES ('128', ' 格侯香', null, '51');
INSERT INTO `stu` VALUES ('129', ' 柳谷晓', null, '28');
INSERT INTO `stu` VALUES ('130', ' 筠景忻', null, '90');
INSERT INTO `stu` VALUES ('256', null, null, null);
mysql> SELECT sex, COUNT(*) AS count FROM stu GROUP BY sex;
+------+-------+
| sex ?| count |
+------+-------+
| 女 ? | ? ?14 |
| NULL | ? 104 |
| 男 ? | ? ?13 |
+------+-------+
3 rows in setmysql> SELECT COALESCE(sex, '未知') AS sex, COUNT(*) AS count FROM stu GROUP BY sex;
+------+-------+
| sex ?| count |
+------+-------+
| 女 ? | ? ?14 |
| 未知 | ? 104 |
| 男 ? | ? ?13 |
+------+-------+
3 rows in setmysql>?
文章来源:https://blog.csdn.net/laocooon/article/details/134986005
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!