zoukankan      html  css  js  c++  java
  • 创建表格 练习题

    create database 晚homework
    go
    use 晚homework
    go
    create table Student
    (
      Sno char(3) primary key,
      Sname char(8) not null,
      Ssex char(2) not null,
      Sbirthday datetime,
      Class char(5)
    )

    create table Course
    (
    Cno char(5) primary key,
    Cname varchar(10) not null,
    Tno char(3) references Teacher(Tno) not null
    )

    create table Score
    (
    Sno char(3)references Student(Sno) not null,
    Cno char(5)references  Course(Cno) not  null,
    Degree decimal(4,1)
    primary key(sno,cno)

    )
    create table Teacher
    (
    Tno char(3)   primary key,
    Tname char(4) not null,
    Tsex char(2) not null,
    Tbirthday datetime ,
    Prof char(6) ,
    Depart varchar(10) not null

    )

    insert  into Student values('108','曾华','男','1977-09-01','95033')
    insert  into Student values('105','匡明','男','1975-10-02','95031')
    insert  into Student values('107','王丽','女','1976-01-23','95033')
    insert  into Student values('101','李军','男','1976-01-20','95033')
    insert  into Student values('109','王芳','女','1975-02-10','95031')
    insert  into Student values('103','陆军','男','1974-06-03','95031')


    insert into Course values('3-105','计算机导论','825')
    insert into Course values('3-245','操作系统','804')
    insert into Course values('6-166','数字电路','856')
    insert into Course values('9-888','高等数学','831')


    insert into Score values('103','3-245','86')
    insert into Score values('105','3-245','75')
    insert into Score values('109','3-245','68')
    insert into Score values('103','3-105','92')
    insert into Score values('105','3-105','88')
    insert into Score values('109','3-105','76')
    insert into Score values('101','3-105','64')
    insert into Score values('107','3-105','91')
    insert into Score values('108','3-105','78')
    insert into Score values('101','6-166','85')
    insert into Score values('107','6-166','79')
    insert into Score values('108','6-166','81')


    insert into Teacher values('804','李诚','男','1958-12-02','副教授','计算机系')
    insert into Teacher values('856','张旭','男','1969-03-12','讲师','电子工程系')
    insert into Teacher values('825','王萍','女','1972-05-05','助教','计算机系')
    insert into Teacher values('831','刘冰','女','1977-08-14','助教','电子工程系')

  • 相关阅读:
    51nod 1412 AVL树的种类
    bzoj1093 [ZJOI2007]最大半联通子图 缩点 + 拓扑序
    bzoj1116 [POI2008]CLO 边双联通分量
    luoguP4366 [Code+#4]最短路 最短路
    51nod1821 最优集合 贪心
    51nod2000 四边形分割平面 规律题
    luoguP3250 [HNOI2016]网络 树链剖分 + 堆
    [Luogu5162]WD与积木(多项式求逆)
    [Luogu5161]WD与数列(后缀数组/后缀自动机+线段树合并)
    [Luogu5106]dkw的lcm
  • 原文地址:https://www.cnblogs.com/wei270647220/p/4134404.html
Copyright © 2011-2022 走看看