2014年10月9日 星期四

[LTU]1008資料庫系統test1

1.擷取所有主修'CS'的大四學生
mysql> select Name from STUDENT where Major='CS';
+-------+
| Name  |
+-------+
| Smith |
| Brown |
+-------+
2 rows in set (0.00 sec)


2.擷取所有在2007及2008年由King教授所開得課程名稱
mysql> select Course_name from COURSE,SECTION where COURSE.Course_number=SECTION.Course_number and Instructor='King' and Year between '07' and '08';
+----------------------+
| Course_name          |
+----------------------+
| Discrete Mathematics |
+----------------------+
1 row in set (0.02 sec)


3.對每一學期由king教授所開得課程擷取其課程編號, 學期(semester), 學年及修課的學生人數
mysql> select Course_number,Semester,Year,count(Student_number) as count from SECTION,GRADE_REPORT where SECTION.Section_identifier=GRADE_REPORT.Section_identifier and Instructor='King';
+---------------+----------+------+-------+
| Course_number | Semester | Year | count |
+---------------+----------+------+-------+
| MATH2410      | Fall     | 07   |     1 |
+---------------+----------+------+-------+
1 row in set (0.01 sec)

沒有留言:

張貼留言