Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1of 3

--Assignment no 1--1. select name from student where tot_cred > 100; "Zhang" "Chavez" "Tanaka" 2.

select course_id, grade from takes,student where takes.id= student.id and name= 'Tanaka';

"BIO-101";"A" "BIO-301";"" 3. select distinct instructor.ID, name from teaches, instructor, course where instructor.ID=teaches.ID and course.course_id=teaches.course_id and course.dept_name='Comp. Sci.'; "10101";"Srinivasan" "45565";"Katz" "83821";"Brandt" 4. (select course_id from section where semester='Fall') intersect (select course_id from section where semester='Spring'); "CS-101" Solutions: Railway Schema:1. select stcode1, stcode2 from track where distance < 20; "CST";"BYC" "CST";"DR" "CST";"KRL" "BYC";"DR" "BYC";"KRL" "GRP";"TNA"

2. select id from trainhalts where timein <> timeout and stcode in (select station.stcode from station where station.name='THANE') ; "KP11" "A65" 3. select t.name from trainhalts th, train t,station st where th.id=t.id and st.stcode=th.stcode and th.timein is null and st.name='MUMBAI'; "CST-KYN" "CST-AMR_LOCAL" 4. select st.name from trainhalts th, train t,station st where th.id=t.id and st.stcode=th.stcode and t.name='CST-AMR_LOCAL' order by th.seqno; "MUMBAI" "BYCULLA" "DADAR" "KURLA" "GHATKOPAR" "THANE" "DOMBIVALI" "KALYAN" 5. select distinct name from train, trainhalts where train.id=trainhalts.id and trainhalts.seqno<6 and trainhalts.timeout<>trainhalts.timein trainhalts.stcode in (select stcode from station where station.name='THANE'); --Assignment no 2--1. select count(*) from instructor, teaches where instructor.id=teaches.id;

2. select building,sum(capacity) from classroom group by building; "Painter";10 "Taylor";70 "Packard";500 "Watson";80 4. select dept_name,count(ID) from instructor group by dept_name having count(ID) >0; "Comp. Sci.";3 "Elec. Eng.";1 "History";2 "Music";1 "Finance";2 "Physics";2 "Biology";1 5. select dept_name,count(ID) from instructor group by dept_name having count(ID) >=0; "Comp. Sci.";3 "Elec. Eng.";1 "History";2 "Music";1 "Finance";2 "Physics";2 "Biology";1

You might also like