Blogger Information
Blog 20
fans 0
comment 1
visits 13151
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
mysql 建表语句练习
zg的php学习
Original
635 people have browsed it

mysql 建表语句练习

用户管理表

  1. CREATE TABLE sc_yhxx (
  2. yhid int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户id',
  3. yhzh varchar(40) NOT NULL COMMENT '账号',
  4. yhmm char(32) NOT NULL COMMENT '密码',
  5. yhxm varchar(40) NOT NULL COMMENT '姓名',
  6. yhxb tinyint(1) not null comment '性别 1男 2女 9未说明',
  7. yddh varchar(20) NOT NULL COMMENT '移动电话',
  8. zcsj int(10) unsigned NOT NULL DEFAULT '0' COMMENT '注册时间',
  9. dlsj int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最后一次登录时间',
  10. zxbz tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '注销标志 1注销 0正常',
  11. PRIMARY KEY (yhid)
  12. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

商品表

  1. create table sc_goods(
  2. spid int(20) unsigned not null auto_increment comment '商品id',
  3. spbm varchar(60) comment '商品编码',
  4. spmc varchar(200) not null comment '商品名称',
  5. pydm varchar(20) comment '拼音代码',
  6. spgg varchar(100) comment '商品规格',
  7. spxh varchar(100) comment '商品型号',
  8. sccj int(10) comment '生产厂家编号',
  9. spdj decimal(12,2) not null comment '商品单价',
  10. zxbz tinyint(1) unsigned not null default '0' comment '注销标志 1注销 0正常',
  11. primary key (spid)
  12. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

订单表

  1. create table sc_order(
  2. ddbh varchar(60) not null comment '订单编号',
  3. yhid int(10) unsigned NOT NULL comment '用户id',
  4. spid int(20) unsigned not null comment '商品id',
  5. spdj decimal(12,2) not null comment '商品单价',
  6. spsl int(10) not null comment '商品数量',
  7. yhzk decimal(6,2) not null default '100.00' comment '优惠折扣',
  8. zxbz tinyint(1) unsigned not null default '0' comment '注销标志 1注销 0正常',
  9. primary key(djbh,spid)
  10. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post