为什么我的视图查询分为两部分?

时间:2013-10-09 23:54:57

标签: sql oracle

我正在尝试创建一个视图,记录所有计算机科学专业的选定属性。

这是我创建视图的查询:

DROP VIEW   CS_grade_report;

CREATE VIEW CS_grade_report AS
SELECT      Student.student_id AS "ID", 
            student_name AS "Name", 
            course_number AS "Course #", 
            credit AS "Credit", 
            grade AS Grade
FROM        Student, Class, Enrolls
WHERE       major = 'CSCI'
AND         Student.student_id = Enrolls.student_id
AND         Class.schedule_num = Enrolls.schedule_num;

SELECT  *
FROM    CS_grade_report;

这就是生成的内容:

ID     Name                      Course #     Credit GR
------ ------------------------- -------- ---------- --
600000 John Smith                CSCI3200          4 B+
600000 John Smith                CSCI3700          3 C
600000 John Smith                SPAN1004          3 A-
600000 John Smith                CSCI4300          3 A+
600001 Andrew Tram               MUSC2406          2 A+
600001 Andrew Tram               SPAN1004          3 A
600001 Andrew Tram               CSCI3700          3 B-
600002 Jane Doe                  CSCI4200          3 D+
600003 Michael Jordan            CSCI4300          3 A+
600004 Tiger Woods               MUSC1000          1 A
600007 Dominique Davis           CSCI4300          3 F

ID     Name                      Course #     Credit GR
------ ------------------------- -------- ---------- --
600009 Will Smith                CSCI3200          4 A
600010 Papa Johns                CSCI3200          4 B
600011 John Doe                  CSCI3200          4 C
600012 Jackie Chan               CSCI3200          4 D
600013 Some Guy                  CSCI3200          4 E

16 rows selected.

1 个答案:

答案 0 :(得分:1)

我假设这是从sqlplus输出的。有一个" pagesize"用于定义何时添加中断的选项。如果您只想查看一个标题,请在运行SELECT语句之前将大小设置为足够大的值:

set pagesize 500  

(或任何你想要的尺寸)

sqlplus有很多命令选项。这link是一本很好的备忘单。