分组统计
练习SQL脚本
/*
Navicat Premium Data Transfer
File Encoding : utf-8
Date: 07/29/2019 15:12:46 PM
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for `goods`
-- ----------------------------
DROP TABLE IF EXISTS `goods`;
CREATE TABLE `goods` (
`id` bigint(11) NOT NULL AUTO_INCREMENT,
`goods_name` varchar(20) DEFAULT NULL,
`cat_id` int(5) DEFAULT NULL,
`goods_num` int(10) DEFAULT NULL,
`goods_price` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of `goods`
-- ----------------------------
BEGIN;
INSERT INTO `goods` VALUES ('1', '钢笔', '1', '3', '4'), ('2',