关于mysql

本帖最后由 wangjian 于 2011-7-26 21:15 编辑

有一个人给我发了么一个内容的东西,让我去mqsql机器上跑一下,怎么跑呀?一个名为txt的文件?
CREATE DATABASE `tuan` DEFAULT CHARACTER SET utf8;

USE `tuan`;

CREATE TABLE deal (
    id INTEGER NOT NULL AUTO_INCREMENT,
    city_id INTEGER,
        city_name VARCHAR(255),
    title VARCHAR(1024),
        merchant_id INTEGER,
        merchant_name VARCHAR(255),
    gp_deal_id INTEGER,
        deal_id INTEGER,
        gp_sellcount INTEGER default 0,
        sellcount INTEGER default 0,
        start_time TIMESTAMP,
        end_time TIMESTAMP,
        PRIMARY KEY (id)
) AUTO_INCREMENT=1000000000 DEFAULT CHARSET=utf8;
ALTER TABLE deal ADD INDEX index_deal_gp (gp_deal_id);
ALTER TABLE deal ADD INDEX index_deal_time (deal_id, start_time, end_time);


CREATE TABLE deal_upload (
    id INTEGER NOT NULL AUTO_INCREMENT,
        gp_deal_id INTEGER,
        deal_id INTEGER,
        ret_desc VARCHAR(255),
        ret_code SMALLINT,
        create_time TIMESTAMP,
        PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;
ALTER TABLE deal_upload ADD INDEX index_upload_gp (gp_deal_id);

create table deal_code_verify (
        id INTEGER NOT NULL AUTO_INCREMENT,
        gp_deal_id INTEGER,
        verify_code VARCHAR(20),
        sn VARCHAR(20),
        ret_desc VARCHAR(255),
        ret_code SMALLINT,
        use_time TIMESTAMP,
        create_time TIMESTAMP,
        PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;
ALTER TABLE deal_code_verify ADD INDEX index_verify_gp (gp_deal_id);

create table deal_code_query (
        id INTEGER NOT NULL AUTO_INCREMENT,
        gp_deal_id INTEGER,
        verify_code VARCHAR(20),
        ret_desc VARCHAR(255),
        ret_code SMALLINT,
        create_time TIMESTAMP,
        PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;
ALTER TABLE deal_code_query ADD INDEX index_query_gp (gp_deal_id);

create table deal_cancel (
        id INTEGER NOT NULL AUTO_INCREMENT,
        gp_deal_id INTEGER,
        ret_desc VARCHAR(255),
        ret_code SMALLINT,
        create_time TIMESTAMP,
        PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;
ALTER TABLE deal_cancel ADD INDEX index_cancel_gp (gp_deal_id);

create table deal_sellcount (
        id INTEGER NOT NULL AUTO_INCREMENT,
        ret_desc VARCHAR(255),
        ret_code SMALLINT,
        data  VARCHAR(2048),
        create_time TIMESTAMP,
        PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;


create table sold (
        id integer auto_increment primary key,
        deal_id integer,
        cnt integer comment 'count sold in tuan',
        total_price decimal(12,2) comment 'total price',
        our_cnt integer comment 'count sold in our platform',
        index sold_deal_id (deal_id)
) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;

create table sold_detail (
        id integer auto_increment primary key,
        deal_id integer,
        sn varchar(128) comment ' tuan serial no',
        no varchar(32) comment 'user  no',
        phone_no varchar(20) comment 'user phone no',
        created timestamp comment 'created time',
        index sold_detail_deal_id (deal_id)
) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;

GRANT ALL PRIVILEGES ON tuan.* TO 'stardeals'@'%' IDENTIFIED BY '5742d34l5' WITH GRANT OPTION;
Tencent64:/data #

添加新评论 »