SQL Query Assignment The schema of these relations is: Courses (course, credits,
ID: 3870940 • Letter: S
Question
SQL Query Assignment
The schema of these relations is: Courses (course, credits, days, tine, room, title, prof, dept) Profs (pname, given, office, ext, email) Students (name, given, linux, major, email) Enroll (linux, course, grade) Coreq (lect, lab) Dayx (days, dayo, day, jour -- ex: MNF | 1 Non lundi All attributes are CHARACTER, except for credits, grade, dayo and ext, which are integer. Primary keys are underlined SQL statements. here is an outline of the various clauses of SELECT. You can type any sql statement in psql, they can cover several lines, and end with a semicolon (:). Up-arrow recalls previous lines In this outline, keywords are bold, optional things are in square brackets] and one or more things in scurly brackets) · o select list of attributes and aggregate functions o from tablenames o [where conditionsj o group by o [having (conditions 1] o order by column (s) [descending]Explanation / Answer
1. select * from Students s,Enroll e where s.linux=e.linux and e.course in ('CSE207', 'Stat Anual Bus Decision I') order by s.name ;
2. select c.course,c.title,c.prof from Courses c,student s,Enroll e where c.course=e.course and e.linux=s.linux and s.name ='kumar';
3. select c.course,c.title,c.prof from Courses c outer join Courses cs on c.course=cs.course join student s on s.name ='kumar' join enroll e on e.linux=s.linux and c.course=e.course;
4. select c.course,c.title,c.day,c.time,c.room,d.dayo from Courses c,Dayx d where d.days=c.days order by dayo,time;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.