MySQL数据库创建及脚本创建

关于MySQL的C++/MFC编程

1项目环境搭建

1、  使用VS2008编译工具

2、  安装mysql-essential-5.1.47-win32.msi

3、  安装mysql-connector-odbc-5.1.7-win32.msi

4、  安装navicat8lite_mysql_cs.exe

2 MySQL数据创建

1.1数据脚本制作

下面创建数据库的表:分别是(SCHOOL)学校,(COLLEGE)学院,(PROFESSIONAL)专业,(CLASS)班级,(STUDENT)学生,(COURSE)分数。

/*-------------------------------------------------------*/

/* DBMS name:   MySQL5.1            */                     

/* Created on:  2012-8-4 9:02:00        */                        

/*-------------------------------------------------------*/

 

drop table if exists T_BAS_SCHOOL;

drop table if exists T_BAS_COLLEGE;

drop table if exists T_BAS_PROFESSIONAL;

drop table if exists T_BAS_CLASS;

drop table if exists T_BAS_STUDENT;

drop table if exists T_BAS_COURSE;

 

 

/*-------------------------------------------------------*/

/* Table:  T_BAS_SCHOOL             */                      

/*-------------------------------------------------------*/

create table T_BAS_SCHOOL

(

   ID               int not nullauto_increment,

   szName           text not null,

   szAddress        text not null,

   szPhone          text not null,

   iReserve         int default 0,

   szReserve        text defaultNULL,

   primary key (ID)

);

 

/*-------------------------------------------------------*/

/* Table:  T_BAS_COLLEGE             */                      

/*-------------------------------------------------------*/

create table T_BAS_COLLEGE

(

   ID               int not nullauto_increment,

   szName           text not null,

   iShoolID         int  not null,

   iReserve         int default 0,

   szReserve        text defaultNULL,

   primary key (ID)

);

 

/*-------------------------------------------------------*/

/* Table:  T_BAS_PROFESSIONAL        */                      

/*-------------------------------------------------------*/

create table T_BAS_PROFESSIONAL

(

   ID               int not nullauto_increment,

   szName           text not null,

   iCollegeID       int  not null,

   iReserve         int default 0,

   szReserve        text defaultNULL,

   primary key (ID)

);

 

/*-------------------------------------------------------*/

/* Table:  T_BAS_CLASS               */                      

/*-------------------------------------------------------*/

create table T_BAS_CLASS

(

   ID               int not nullauto_increment,

   szName           text not null,

   iProfessionalID  int  not null,

   iReserve         int default 0,

   szReserve        text defaultNULL,

   primary key (ID)

);

 

/*-------------------------------------------------------*/

/* Table:  T_BAS_STUDENT            */                      

/*-------------------------------------------------------*/

create table T_BAS_STUDENT

(

   ID               int not null auto_increment,

   szName           text not null,

   iClassID         int  not null,

   iReserve         int default 0,

   szReserve        text defaultNULL,

   primary key (ID)

);

 

/*-------------------------------------------------------*/

/* Table:  T_BAS_COURSE             */                      

/*-------------------------------------------------------*/

create table T_BAS_COURSE

(

   ID               int not null,

   szName           text not null,

   primary key (ID)

);

1.2 数据创建

  使用NavicatLite for MySQL将脚本导入,注意字符选择。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值