数据库零碎概念第六版答案(包括实践习题,习题)例如3.11答案Exercises•WritethefollowingqueriesinSQL,usingtheuniversityschema.•FindthenamesofallstudentswhohavetakenatleastoneComp.Sci.course;makesuretherearenoduplicatenamesintheresult.•FindtheIDsandnamesofallstudentswhohavenottakenanycourseofferingbeforeSpring2009.11•Foreachdepartment,findthemaximumsalaryofinstructorsinthatdepartment.Youmayassumethateverydepartmenthasatleastoneinstructor.•Findthelowest,acrossalldepartments,oftheper-departmentmax-imumsalarycomputedbytheprecedingquery.Answer:•SQLquery:selectnamefromstudentnaturaljointakesnaturaljoincoursewherecourse.dept=’Comp.Sci.’•SQLquery:selectid,namefromstudentexceptselectid,namefromstudentnaturaljointakeswhereyear<2009Sincetheexceptoperatoreliminatesduplicates,thereisnoneedtouseaselectdistinctclause,althoughdoingsowouldnotaffectcorrectnessofthequery.•SQLquery:selectdept,max(salary)frominstructorgroupbydept
1