zoukankan      html  css  js  c++  java
  • 第十二章

    create procedure UP_TEACHER_INFO
    as
    select * from Teacher where Teacher_Sex=''
    go
    
    create procedure UP_course_info
    @scname varchar(30)
    as
    select Student.Student_No,Student_Name,Course_Name,SelectCourse_Score
    from Student,SelectCourse,Course
    where Student.Student_No=SelectCourse.SelectCourse_StudentNo
    and SelectCourse.SelectCourse_CourseNo=Course.Course_No
    and Course_Name=@scname
    go
    
    create procedure UP_course_count
    @scname varchar(30),@ccount int output
    as
    select @ccount=count(*)
    from SelectCourse,Course
    where SelectCourse.SelectCourse_CourseNo=Course.Course_No
    and Course_Name=@scname
    go
    
    exec UP_TEACHER_INFO
    go
    
    declare @ccount int
    exec UP_course_count @scname='数据结构',@ccount=@ccount output
    select '选修数据结构课程的人数:',@ccount
    
    exec UP_course_info'数据结构'
    go
     
    declare @ccount int
    exec UP_course_count'数据结构',@ccount output
    select '选修数据结构课程的人数:',@ccount
    go
    
    exec sp_helptext up_course_info
    exec sp_help up_course_info
    exec sp_depends up_course_info
    exec sp_stored_procedures up_course_info
    go
    
    alter procedure UP_course_info
    @s_no char(6)
    as
    select Student.Student_No,Student_Name,Course_Name,SelectCourse_Score
    from Student,SelectCourse,Course
    where Student.Student_No=SelectCourse.SelectCourse_StudentNo
    and SelectCourse.SelectCourse_CourseNo=Course.Course_No
    and Student.Student_No=@s_no
    go
    
    drop procedure UP_TEACHER_INFO
    go
    
    
    
    
    alter procedure UP_course_info
    @s_no char(6)=null
    as
    if @s_no is null
        begin
            select Student.Student_No,Student_Name,Course_Name,SelectCourse_Score
            from Student,SelectCourse,Course
            where Student.Student_No=SelectCourse.SelectCourse_StudentNo
            and SelectCourse.SelectCourse_CourseNo=Course.Course_No
        end
    else
        begin
            select Student.Student_No,Student_Name,Course_Name,SelectCourse_Score
            from Student,SelectCourse,Course
            where Student.Student_No=SelectCourse.SelectCourse_StudentNo
            and SelectCourse.SelectCourse_CourseNo=Course.Course_No
            and Student.Student_No=@s_no
        end
    go
    
    
    exec UP_course_info
    exec UP_course_info'201901'
  • 相关阅读:
    Chapter 7 Integrity(完整性), Views(视图), Security(安全性), and Catalogs(目录)
    Qt计时器
    linux命令:linux文件处理命令
    JSON.stringify()的不常见用法
    flex知识点归纳
    css伪类
    开发资源汇总
    Math.cbrt() Math.sqrt() Math.pow()
    代码开发注意事项和规范
    关于数组数据容易忽略的点
  • 原文地址:https://www.cnblogs.com/King-boy/p/10963674.html
Copyright © 2011-2022 走看看