mysql的学习: 先介绍一下个人情况:不是小白但很菜! 具体如下: 第一步:安装mysql、Navicat 第二步:做一个具体的数据库,边敲边学(理论我都懂,所以直接跳过) 我选的是一个学生选课表 具体如下:
CREATE TABLE
IF
NOT EXISTS Student (
Sid VARCHAR ( 10 ) PRIMARY KEY,
Sname VARCHAR ( 20 ),
Ssex VARCHAR ( 2 ) CHECK( ssex in ('男'or'女')),
Spre VARCHAR ( 20 ),
Sdep VARCHAR ( 20 ),
Stel VARCHAR ( 13 ));
CREATE TABLE
IF
NOT EXISTS Teacher (
Tid VARCHAR ( 10 ) PRIMARY KEY,
Tname VARCHAR ( 20 ),
Tsex VARCHAR ( 2 ) CHECK( tsex in ('男'or'女')),
Tcou VARCHAR ( 20 ),
Ttel VARCHAR ( 13 )
) ;CREATE TABLE
IF
NOT EXISTS Department (
Tid VARCHAR ( 10 ) PRIMARY KEY,
Tmc VARCHAR ( 20 ),
Tname VARCHAR ( 20 ),
Ttel VARCHAR ( 13 )) ;CREATE TABLE
IF
NOT EXISTS Course ( Cid VARCHAR ( 10 ) PRIMARY KEY,
Cname VARCHAR ( 20 ),
Stc VARCHAR ( 10 ),
Cxf VARCHAR ( 5 ) ) ;
CREATE TABLE
IF
NOT EXISTS Achievement ( Sid VARCHAR ( 10 ),
Sname VARCHAR ( 20 ),
Aid VARCHAR ( 10 ),
Cname VARCHAR ( 20 ),
Afs TINYINT ) ;
CREATE TABLE
IF
NOT EXISTS Administration (
Aname VARCHAR ( 10 ),
Asex VARCHAR ( 2 ) CHECK( asex in ('男'or'女')),
Atel VARCHAR ( 13 ));
|