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

  • 相关阅读:
    BaseDao
    url中文参数解决方案
    Ajax实现步骤和原理
    在服务器端使用文件时的路径解决方案
    用户验证登录拦截器
    jenkins环境搭建
    gitlab环境搭建
    nexus3.X环境搭建
    base64文件大小计算
    JVM远程调试功能
  • 原文地址:https://www.cnblogs.com/onda/p/7145360.html
Copyright © 2011-2022 走看看