データテーブルSQLファイルの使用法
/* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Version : 50553 Source Host : localhost:3306 Source Database : shop Target Server Type : MYSQL Target Server Version : 50553 File Encoding : 65001 Date: 2017-06-24 15:51:11 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `php_attr` -- ---------------------------- DROP TABLE IF EXISTS `php_attr`; CREATE TABLE `php_attr` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `attr_name` varchar(20) NOT NULL COMMENT '属性名称', `attr_type` enum('0','1') NOT NULL COMMENT '属性类型 0:唯一属性 1:单选属性', `attr_values` text NOT NULL COMMENT '属性值', `type_id` mediumint(9) NOT NULL COMMENT '对应类型id', PRIMARY KEY (`id`), KEY `type_id` (`type_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of php_attr -- ---------------------------- -- ---------------------------- -- Table structure for `php_brand` -- ---------------------------- DROP TABLE IF EXISTS `php_brand`; CREATE TABLE `php_brand` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `brand_name` varchar(30) NOT NULL, `brand_logo` varchar(100) NOT NULL, `brand_url` varchar(100) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of php_brand -- ---------------------------- -- ---------------------------- -- Table structure for `php_goods` -- ---------------------------- DROP TABLE IF EXISTS `php_goods`; CREATE TABLE `php_goods` ( `id` int(11) NOT NULL AUTO_INCREMENT, `goods_name` varchar(30) NOT NULL COMMENT '商品名称', `goods_sn` char(16) NOT NULL COMMENT '商品编号', `original` varchar(100) NOT NULL COMMENT '原图', `sm_thumb` varchar(100) NOT NULL COMMENT '小缩略图', `mid_thumb` varchar(100) NOT NULL COMMENT '中缩略图', `max_thumb` varchar(100) NOT NULL COMMENT '大缩略图', `market_price` decimal(10,2) NOT NULL COMMENT '市场价格', `shop_price` decimal(10,2) NOT NULL COMMENT '本店价格', `onsale` enum('1','0') NOT NULL DEFAULT '1' COMMENT '是否上架', `cate_id` mediumint(9) NOT NULL COMMENT '所属栏目', `brand_id` mediumint(9) NOT NULL DEFAULT '0' COMMENT '所属品牌', `type_id` mediumint(9) NOT NULL DEFAULT '0' COMMENT '所属商品类型', `goods_desc` text NOT NULL COMMENT '详情描述', `goods_weight` decimal(10,2) NOT NULL COMMENT '商品重量', `weight_unit` enum('g','kg') NOT NULL DEFAULT 'g' COMMENT '重量单位', `addtime` int(10) NOT NULL DEFAULT '0' COMMENT '上架时间', `updatetime` int(10) NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`id`), KEY `shop_price` (`shop_price`,`cate_id`,`brand_id`,`type_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of php_goods -- ---------------------------- -- ---------------------------- -- Table structure for `php_goods_attr` -- ---------------------------- DROP TABLE IF EXISTS `php_goods_attr`; CREATE TABLE `php_goods_attr` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `goods_id` mediumint(8) unsigned NOT NULL COMMENT '商品id', `attr_id` mediumint(8) unsigned NOT NULL COMMENT '属性id', `attr_value` varchar(150) NOT NULL COMMENT '属性值', `attr_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '属性价格', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of php_goods_attr -- ---------------------------- -- ---------------------------- -- Table structure for `php_goods_pic` -- ---------------------------- DROP TABLE IF EXISTS `php_goods_pic`; CREATE TABLE `php_goods_pic` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `goods_id` mediumint(8) unsigned NOT NULL COMMENT '商品id', `original` varchar(100) NOT NULL COMMENT '商品原图', `max_thumb` varchar(100) NOT NULL COMMENT '大缩略图', `sm_thumb` varchar(100) NOT NULL COMMENT '小缩略图', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of php_goods_pic -- ---------------------------- -- ---------------------------- -- Table structure for `php_member` -- ---------------------------- DROP TABLE IF EXISTS `php_member`; CREATE TABLE `php_member` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT COMMENT '会员id', `username` varchar(30) NOT NULL COMMENT '用户名称', `password` char(32) NOT NULL COMMENT '用户密码', `email` varchar(50) NOT NULL COMMENT '邮箱', `check_mail` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否已验证 0:未验证 1:已验证', `mail_str` varchar(32) NOT NULL COMMENT '邮箱验证字符串', `sex` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:保密 1:男 2:女', `points` mediumint(8) unsigned NOT NULL DEFAULT '0', `money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '余额', `regtime` int(10) NOT NULL COMMENT '注册时间', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of php_member -- ---------------------------- -- ---------------------------- -- Table structure for `php_member_level` -- ---------------------------- DROP TABLE IF EXISTS `php_member_level`; CREATE TABLE `php_member_level` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `level_name` varchar(20) NOT NULL COMMENT '等级名称', `points_min` int(10) unsigned NOT NULL COMMENT '积分下限', `points_max` int(10) unsigned NOT NULL COMMENT '积分上限', `rate` tinyint(3) unsigned NOT NULL COMMENT '折扣率', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of php_member_level -- ---------------------------- -- ---------------------------- -- Table structure for `php_member_price` -- ---------------------------- DROP TABLE IF EXISTS `php_member_price`; CREATE TABLE `php_member_price` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `price` decimal(10,2) NOT NULL COMMENT '会员等级价格', `level_id` mediumint(9) NOT NULL COMMENT '等级id', `goods_id` mediumint(9) NOT NULL COMMENT '商品id', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of php_member_price -- ---------------------------- -- ---------------------------- -- Table structure for `php_product` -- ---------------------------- DROP TABLE IF EXISTS `php_product`; CREATE TABLE `php_product` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `goods_id` mediumint(9) NOT NULL COMMENT '商品id', `goods_number` int(11) NOT NULL COMMENT '库存量', `goods_attr` varchar(150) NOT NULL COMMENT '库存属性', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of php_product -- ---------------------------- -- ---------------------------- -- Table structure for `php_type` -- ---------------------------- DROP TABLE IF EXISTS `php_type`; CREATE TABLE `php_type` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `type_name` varchar(20) NOT NULL COMMENT '类型名称', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of php_type -- ----------------------------
sql ファイルはパッケージ化できます。データベースに新しいデータ テーブルを作成し、使用するファイルをインポートするだけです