zoukankan      html  css  js  c++  java
  • MySql学习笔记

    MySql学习视频地址:

    https://www.bilibili.com/video/BV1fx411X7BD?p=55&spm_id_from=pageDriver

    P55:外键约束

    drop table if exists t_student;
    drop table if exists t_class;
    
    
    create table t_class(
    	cno int primary key,
    	cname varchar(255)
    );
    create table t_student (
    	sno int primary key,
    	sname varchar(255),
    	classno int,
    	foreign key(classno) references t_class(cno)
    );
    insert into t_class values(101,"xxxxxxxxxxx");
    insert into t_class values(102,"yyyyyyyyy");
    
    insert into t_student values(1,"zs01",101);
    insert into t_student values(2,"zs02",101);
    insert into t_student values(3,"zs03",102);
    insert into t_student values(4,"zs04",102);
    insert into t_student values(5,"zs05",102);
    
    select * from t_class;
    select * from t_student;
    

      

  • 相关阅读:
    bzoj1027
    bzoj1069
    poj2079
    poj2187
    bzoj2281
    bzoj2285
    bzoj1558
    bzoj1822
    bzoj1559
    bzoj1570
  • 原文地址:https://www.cnblogs.com/yiweiyihang/p/15409647.html
Copyright © 2011-2022 走看看