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));

  • 相关阅读:
    第二周作业第1题——滕飞
    现代软件工程_第02周_第01题_纪梓潼
    计算机系统分类
    1,性能测试关键指标
    01,python变量
    2.7 生命周期各测试方法对比
    2.6 软件测试方法
    2.5 软件的开发文档和测试文档
    2.4 软件的开发模块
    2.3 软件的生命周期
  • 原文地址:https://www.cnblogs.com/onda/p/7145360.html
Copyright © 2011-2022 走看看