recategorized by
3,922 views
20 votes
20 votes

The following relations are used to store data about students, courses, enrollment of students in courses and teachers of courses. Attributes for primary key in each relation are marked by ‘*’.

Students (rollno*, sname, saddr)
courses (cno*, cname)
enroll(rollno*, cno*, grade)
teach(tno*, tname, cao*)

(cno is course number cname is course name, tno is teacher number, tname is teacher name, sname is student name, etc.)

Write a SQL query for retrieving roll number and name of students who got A grade in at least one course taught by teacher names Ramesh for the above relational database.

recategorized by

5 Answers

0 votes
0 votes
SELECT s.rollno, s.sname FROM students s natural join enroll e 
WHERE e.grade='A' AND e.cno in (SELECT cno from teach where tname='Ramesh')

Related questions

30 votes
30 votes
4 answers
4
Kathleen asked Sep 29, 2014
4,657 views
Let $\left(\{ p,q \},*\right)$ be a semigroup where $p*p=q$. Show that:$p*q=q*p$ and$q*q=q$