sample question
sample question
1. Find all those students who have registered the course ‘cse 1151’
Select *
from student s, registration r
where s.sid=r.sid and r.cid like "cse1151"
or
Select *
from student s, registration r
where s.sid=r.sid and r.cid = "cse1151"
or
Select *
from student s
inner join registration r
on s.sid=r.sid
where r.cid = "cse1151"
2. Find the names of all those students who have registered the course ‘1153’
Select s.sname, s.sid, r.cid
from student s, registration r
where s.sid=r.sid and r.cid like "cse1153"
or
Select s.sname, s.sid, r.cid
from student s, registration r
where s.sid=r.sid and r.cid ="cse1153"
or
Select s.sname, s.sid, r.cid
from student s
inner join registration r
on s.sid=r.sid
where r.cid ="cse1153"
3. Find the names and student ids of all those students who have registered the course titled ‘computer fundamentals’
Select s.sname, s.sid, c.cid, c.ctitle
from course c, registration r, student s
where
c.cid=r.cid
and r.sid=s.sid
and c.ctitle like"*computer fundamentals*"
or
Select s.sname, s.sid, c.cid, c.ctitle
from course c, registration r, student s
where
c.cid=r.cid
and r.sid=s.sid
and c.ctitle="computer fundamentals"
4. Find the names and student ids of all those students who have registered a course that has ‘puter’ in its title.
Select s.sname, s.sid, c.cid, c.ctitle
from course c, registration r, student s
where
c.cid=r.cid
and r.sid=s.sid
and c.ctitle like"*puter*"
5. Find the names, student ids, course titles and course ids of those students who live in ‘nirala’
where
s.sid=r.sid
and r.cid=c.cid
and s.address like"*nirala*"
or
where
s.sid=r.sid
and r.cid=c.cid
and s.address="nirala"