首页 > 代码库 > 网上商城4--首页二级分类的查询

网上商城4--首页二级分类的查询

1.创建表

CREATE TABLE `categorysecond` (
  `csid` int(11) NOT NULL AUTO_INCREMENT,
  `csname` varchar(255) DEFAULT NULL,
  `cid` int(11) DEFAULT NULL,
  PRIMARY KEY (`csid`),
  KEY `FK936FCAF21DB1FD15` (`cid`),
  CONSTRAINT `FK936FCAF21DB1FD15` FOREIGN KEY (`cid`) REFERENCES `category` (`cid`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8;
INSERT INTO `categorysecond` VALUES (‘1‘, ‘潮流女装‘, ‘1‘);
INSERT INTO `categorysecond` VALUES (‘2‘, ‘初冬羽绒‘, ‘1‘);
INSERT INTO `categorysecond` VALUES (‘3‘, ‘毛呢大衣‘, ‘1‘);
INSERT INTO `categorysecond` VALUES (‘4‘, ‘温暖毛衣‘, ‘1‘);
INSERT INTO `categorysecond` VALUES (‘5‘, ‘精选男装‘, ‘1‘);
INSERT INTO `categorysecond` VALUES (‘6‘, ‘冬季外套‘, ‘1‘);
INSERT INTO `categorysecond` VALUES (‘7‘, ‘羽绒服‘, ‘1‘);
INSERT INTO `categorysecond` VALUES (‘9‘, ‘女鞋‘, ‘2‘);
INSERT INTO `categorysecond` VALUES (‘10‘, ‘短靴‘, ‘2‘);
INSERT INTO `categorysecond` VALUES (‘11‘, ‘男鞋‘, ‘2‘);
INSERT INTO `categorysecond` VALUES (‘12‘, ‘女包‘, ‘2‘);
INSERT INTO `categorysecond` VALUES (‘13‘, ‘男包‘, ‘2‘);
INSERT INTO `categorysecond` VALUES (‘14‘, ‘服饰配件‘, ‘2‘);
INSERT INTO `categorysecond` VALUES (‘15‘, ‘运动鞋‘, ‘3‘);
INSERT INTO `categorysecond` VALUES (‘16‘, ‘运动服‘, ‘3‘);
INSERT INTO `categorysecond` VALUES (‘17‘, ‘户外运动‘, ‘3‘);
INSERT INTO `categorysecond` VALUES (‘18‘, ‘健身装备‘, ‘3‘);
INSERT INTO `categorysecond` VALUES (‘19‘, ‘骑行装备‘, ‘3‘);
INSERT INTO `categorysecond` VALUES (‘20‘, ‘珠宝首饰‘, ‘4‘);
INSERT INTO `categorysecond` VALUES (‘21‘, ‘时尚饰品‘, ‘4‘);
INSERT INTO `categorysecond` VALUES (‘22‘, ‘品质手表‘, ‘4‘);
INSERT INTO `categorysecond` VALUES (‘23‘, ‘眼镜配饰‘, ‘4‘);
INSERT INTO `categorysecond` VALUES (‘24‘, ‘手机‘, ‘5‘);
INSERT INTO `categorysecond` VALUES (‘25‘, ‘平板‘, ‘5‘);
INSERT INTO `categorysecond` VALUES (‘26‘, ‘电脑‘, ‘5‘);
INSERT INTO `categorysecond` VALUES (‘27‘, ‘相机‘, ‘5‘);
INSERT INTO `categorysecond` VALUES (‘28‘, ‘大家电‘, ‘6‘);
INSERT INTO `categorysecond` VALUES (‘29‘, ‘厨房电器‘, ‘6‘);
INSERT INTO `categorysecond` VALUES (‘30‘, ‘生活电器‘, ‘6‘);
INSERT INTO `categorysecond` VALUES (‘31‘, ‘个户电器‘, ‘6‘);
INSERT INTO `categorysecond` VALUES (‘32‘, ‘办公耗材‘, ‘6‘);
INSERT INTO `categorysecond` VALUES (‘33‘, ‘美容护肤‘, ‘7‘);
INSERT INTO `categorysecond` VALUES (‘34‘, ‘强效保养‘, ‘7‘);
INSERT INTO `categorysecond` VALUES (‘35‘, ‘超值彩妆‘, ‘7‘);
INSERT INTO `categorysecond` VALUES (‘36‘, ‘换季保养‘, ‘7‘);

  

网上商城4--首页二级分类的查询