zoukankan      html  css  js  c++  java
  • SQL基础四(例子)

    ------------------------------------------------
    --分别创建student/course/score表
    
    Create table student
    (
    mid char(10) not null primary key,
    mname char(50) not null,
    )
    
    Create table course
    (
    fid char(10) not null primary key,
    fname char(50) not null,
    )
    
    Create table score
    (
    Sid int identity(1,1) primary key,
    fid char(10) not null,
    mid char(10) not null,
    score int,
    foreign key(mid) references student(mid),
    foreign key(fid) references course(fid)
    )
    ------------------------------------------------------
    --
    --往studnt表插入数据
    insert into student(mid,mname) values('M001','张三')
    insert into student(mid,mname) values('M002','李四')
    insert into student(mid,mname) values('M003','王五')
    insert into student(mid,mname) values('M004','顺六')
    -------------------------------------------------------
    --
    --往scourse表插入数据
    insert into course(fid,fname) values('F001','语文')
    insert into course(fid,fname) values('F002','数学')
    insert into course(fid,fname) values('F003','英语')
    insert into course(fid,fname) values('F004','历史')
    -------------------------------------------------------
    --
    --往score表插入数据
    insert into score(fid,mid,score) values('F001','M001',78)
    insert into score(fid,mid,score) values('F002','M001',78)
    insert into score(fid,mid,score) values('F003','M001',78)
    insert into score(fid,mid,score) values('F004','M001',78)
    
    insert into score(fid,mid,score) values('F001','M002',58)
    insert into score(fid,mid,score) values('F002','M002',58)
    insert into score(fid,mid,score) values('F003','M002',68)
    insert into score(fid,mid,score) values('F004','M002',98)
    
    insert into score(fid,mid,score) values('F001','M003',74)
    insert into score(fid,mid,score) values('F002','M003',74)
    insert into score(fid,mid,score) values('F003','M003',71)
    insert into score(fid,mid,score) values('F004','M003',73)
    
    insert into score(fid,mid,score) values('F001','M004',79)
    insert into score(fid,mid,score) values('F002','M004',77)
    insert into score(fid,mid,score) values('F003','M004',1)
    insert into score(fid,mid,score) values('F004','M004',22)
    
    
    -------------------------
    View Code
  • 相关阅读:
    对javascript的一点点认识总结——《javascript高级程序设计》读书笔记
    .Net Garbage Collection学习心得
    上网本重装系统的历程
    让验证控件进行分组验证
    .net应用程序分层的个人认识
    asp.net 4.0的变化(官网链接地址)
    SQL 延时 插入 修改 删除
    SQL 删除前100条 with as
    jQuery RadioButtonList
    网站推广的100个方法
  • 原文地址:https://www.cnblogs.com/tcheng/p/6060778.html
Copyright © 2011-2022 走看看