zoukankan      html  css  js  c++  java
  • python-day11-MYSQL 数据库及数据表

    创库
    create database lianx1 DEFAULT character set utf8


    表################################
    int, 数据类型,表示整数
    not null 表示不能为空
    auto_increment 表示自增
    PRIMARY key 表示主键
    constraint 外键名 foreign key(要关联的列) references 被关联的表(被关联的列);

    创建班级表
    create table class(
    cid int not null auto_increment PRIMARY key,
    caption char(32));


    创建学生表
    create table student(
    sid int not null auto_increment PRIMARY key,
    sname char(32),
    gender char(32),
    class_id int not null,
    constraint stu1 foreign key (class_id) references class(cid));


    创建老师表
    create table teacher(
    tid int not null auto_increment PRIMARY KEY,
    tname char(32));

    创建课程表
    create table course(
    cid int not null auto_increment PRIMARY KEY,
    cname char(32),
    tearch_id int not null,
    constraint cour1 foreign key(tearch_id) references teacher(tid));


    创建成绩表
    create table score(
    sid int not null auto_increment PRIMARY KEY,
    student_id int,
    corse_id int,
    number char(32),
    constraint score1 foreign key (student_id) references student(sid),
    constraint score2 foreign key (corse_id) references course(cid));

  • 相关阅读:
    js,jQuery实现可关闭悬浮框广告特效,兼容(谷歌,火狐,Ie)
    各种选择框jQuery的选中方法
    表单校验demo
    两种方法实现城市级联菜单
    树形菜单
    匿名函数和鼠标移入移除事件
    多线程实例
    Lock锁
    Oracle语句
    Java NIO
  • 原文地址:https://www.cnblogs.com/onda/p/7145360.html
Copyright © 2011-2022 走看看