Home >Database >Mysql Tutorial >省市县三级联动的SQL语句

省市县三级联动的SQL语句

WBOY
WBOYOriginal
2016-06-07 14:57:532730browse

省市县三级联动的SQL语句 无 CREATE TABLE `t_address_province` (`id` INT AUTO_INCREMENT PRIMARY KEY COMMENT '主键',`code` CHAR(6) NOT NULL COMMENT '省份编码',`name` VARCHAR(40) NOT NULL COMMENT '省份名称') ENGINE=InnoDB DEFAULT CHARSET=UTF8 C

省市县三级联动的SQL语句
CREATE TABLE `t_address_province` (

`id` INT AUTO_INCREMENT PRIMARY KEY COMMENT '主键',

`code` CHAR(6) NOT NULL COMMENT '省份编码',

`name` VARCHAR(40) NOT NULL COMMENT '省份名称'

) ENGINE=InnoDB DEFAULT CHARSET=UTF8 COMMENT='省份信息表';

CREATE TABLE `t_address_city` (

`id` INT AUTO_INCREMENT PRIMARY KEY COMMENT '主键',

`code` CHAR(6) NOT NULL COMMENT '城市编码',

`name` VARCHAR(40) NOT NULL COMMENT '城市名称',

`provinceCode` CHAR(6) NOT NULL COMMENT '所属省份编码'

) ENGINE=InnoDB DEFAULT CHARSET=UTF8 COMMENT='城市信息表';

CREATE TABLE `t_address_town` (

`id` INT AUTO_INCREMENT PRIMARY KEY COMMENT '主键',

`code` CHAR(6) NOT NULL COMMENT '区县编码',

`name` VARCHAR(40) NOT NULL COMMENT '区县名称',

`cityCode` CHAR(6) NOT NULL COMMENT '所属城市编码'

) ENGINE=InnoDB DEFAULT CHARSET=UTF8 COMMENT='区县信息表'; 
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn