use myschool
--查詢學生姓名、所屬年級名稱及聯絡**。
select s.studentname as 姓名,g.gradename as 年級,s.phone as **
from student as s
inner join grade as g on s.gradeid=g.gradeid
select s.studentname as 姓名,g.gradename as 年級,s.phone as **
from student as s,grade as g where s.gradeid=g.gradeid
--查詢年級編號為1的科目名稱、年級名稱及學時。
select j.subjectname as 科目名稱,g.gradename as 年級,j.classhour as 學時
from subject as j
inner join grade as g on j.gradeid=g.gradeid
where g.gradeid=1
select j.subjectname as 科目名稱,g.gradename as 年級,j.classhour as 學時
from subject as j,grade as g
where j.gradeid=g.gradeid and g.gradeid=1
--查詢參加科目編號為1的考試的學生姓名、分數、考試日期。
select s.studentname as 姓名,r.studentresult as 分數,r.examdate as 考試日期
from result as r
inner join student as s on r.studentno=s. studentno
where r.subjectid=1
select s.studentname as 姓名,r.studentresult as 分數,r.examdate as 考試日期
from result as r,student as s
where r.studentno=s. studentno and r.subjectid=1
--查詢學號為s1101007的學生參加的考試科目名稱、分數、考試日期。
select j.subjectname as 科目名稱,r.studentresult as 分數,r.examdate as 考試日期
from result as r
inner join subject as j on r.subjectid=j.subjectid
where r.studentno='s1101007'
select j.subjectname as 科目名稱,r.studentresult as 分數,r.examdate as 考試日期
from result as r ,subject as j
where r.subjectid=j.subjectid and r.studentno='s1101007'
--查詢參加考試的學生學號、所考科目名稱、分數、考試日期.
select r.studentno as 學生學號,j.subjectname as 科目名稱,r.studentresult as 分數,r.examdate as 考試日期
from result as r
inner join subject as j on r.subjectid=j.subjectid
select r.studentno as 學生學號,j.subjectname as 科目名稱,r.studentresult as 分數,r.examdate as 考試日期
from result as r,subject as j
where r.subjectid=j.subjectid
sql上機練習5
use myschool 查詢所有科目的參考資訊 某些科目可能還沒有被考試過 select j.subjectname as 科目名稱,r.studentno as 學號,r.studentresult as 分數 from subject as j left outer join result a...
SQL上機練習題2
14道練習題 oracle自帶hr方案 新知識 9.可以用列號表示排序條件 10.使用 可以彈出input框,讓查詢更加靈活 11.同理 hr 部門需要您協助建立一些查詢。1 因為預算問題,hr 部門需要乙個報表,用於顯示薪金高於 12,000 的員工 的姓氏和薪金。將您的 sql 語句儲存到名為 ...
上機練習2 類與物件(3)
課堂練習6 定義乙個圓類 circle 其所在的包為bzu.info.software 定義乙個圓柱類cylinder,其所在的包為bzu.info.com 定義乙個主類a,其所在的包也為bzu.info.com,在a中生成乙個cylinder物件,並輸出其體積。編譯並執行該類。試著改變求體積方法的...