zoukankan      html  css  js  c++  java
  • 建表Table

    
    

    Sstudent

    
    

     

    
    

       

       Sno

      

      Sname

       

       Ssex

         

         Sage

     

       Sdept

      200215121

      200215122

      200215123

      200515125

      李勇

      刘晨

      王敏

      张立

     

     

     

     

      20

      19

      18

      19

        CS

        CS

        MA

        IS

    
    

     

    
    

    Course

    
    

     

    
    

    课程号

    Cno

      课程名

       Cname

       先行课

      Cpno

       学分

     Ccredit

    1

    2

    3

    4

    5

    6

    7

       数据库

       数学

       信息系统

       操作系统

       数据结构

       数据处理

       PASCAL语言

     

        5

     

        1

        6

        7

     

        6

    4

    2

    4

    3

    4

    2

    4

    
    

     

    
    

     

    
    

    SC

    
    

     

    
    

    Sno

     课程号

      Cno

      成绩

        Grade

       200215121

       200215121

       200215121

       200215122

       200215122

      1

      2

      3

      2

      3

     92

     85

     88

     90

     80

    
    

     




    student 表
    create table student ( sno char(10) primary key, sname char(20) not null, Ssex char(20) check( Ssex in('','')), Sage smallint check(Sage between 12 and 40), Sdept char(20) ) insert into student values('200215121','李勇','',20,'CS') insert into student values('200215122','刘晨','',19,'CS') insert into student values('200215123','王敏','',18,'MA') insert into student values('200215125','张立','',19,'IS') course表 create table course ( cno char(10) , --primary key cname char(20), Cpno char(10), Ccredit smallint, constraint cPK primary key(cno), constraint cFK foreign key(Cpno) references course(cno) ) insert into course values('1','数据库',null,4) insert into course values('2','数学',null,2) insert into course values('3','信息系统',null,4) insert into course values('4','操作系统',null,3) insert into course values('5','数据结构',null,4) insert into course values('6','数据处理',null,2) insert into course values('7','PASCAL语言',null,4) update course set cpno='5' where cno='1' update course set cpno='1' where cno='3' update course set cpno='6' where cno='4' update course set cpno='7' where cno='5' update course set cpno='6'where cno='7' select * from course sc 表 完整约束命名子 句----约束名称不能 重复 ________________________________________ create table sc ( sno char(10) not null, cno char(10) not null, grade smallint check(grade>=0 and grade<=100), constraint sPK primary key(sno,cno), constraint sFK foreign key(sno) references student(sno) on delete cascade on update cascade, constraint sFK foreign key(cno) references course(cno) on delete no action on update cascade ) sc 表 create table sc ( sno char(9) not null, cno char(10) not null, grade smallint check(grade>=0 and grade<=100), constraint sPK primary key(sno,cno), constraint sFK1 foreign key(sno) references student(sno) on delete cascade on update cascade, constraint sFK2 foreign key(cno) references course(cno) on delete no action on update cascade ) sc表.note ________________________________________ create table sc ( sno char(9), cno char(10), grade smallint, primary key(sno, cno), foreign key(sno) references student(sno), foreign key(cno) references course(cno) )

     

     

  • 相关阅读:
    中产阶级的特点
    数字化营销的7个增长点
    前沿显微成像技术专题——电压成像
    前沿显微成像技术专题之钙离子成像
    前沿显微成像技术专题
    前沿显微成像技术专题
    单分子荧光成像概述
    前沿显微成像技术专题之:光片荧光显微镜(3)
    前沿显微成像技术专题之:光片荧光显微镜(2)
    前沿显微成像技术专题之:光片荧光显微镜(1)
  • 原文地址:https://www.cnblogs.com/wangprince2017/p/7677941.html
Copyright © 2011-2022 走看看