If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > juniors enrolled in a class taught by I.teach (was "SQL queries....please help...")

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-08-06, 13:38
krishna17 krishna17 is offline
Registered User
 
Join Date: Feb 2006
Posts: 18
juniors enrolled in a class taught by I.teach (was "SQL queries....please help...")



schema:
student(snum:int,sname:string,major:string,level:s tring,age:int)
class(name:string,meet_at:time,room:string,fid:int )
enrolled(snum:int,cname:string)
faculty(fid:int,fname:string,deptid:int)

1:find the names of all juniors (level = JR ) who are enrolled in a class taught byb I.teach.

Sol:select snum,snames from student s , where in (select snum from enrolled e , student s ,faculty f where s.snum = e.snum and s.level = " JR" and c.fid = f.fid and fname = "I.Teach");

Is this right???
Reply With Quote
  #2 (permalink)  
Old 05-08-06, 13:47
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
is it right? no, it's not, you have at least one syntax error, the comma after the s

don't you have a system to test on? is this a paper homework assignment?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 05-08-06, 14:40
krishna17 krishna17 is offline
Registered User
 
Join Date: Feb 2006
Posts: 18
sql queries...pleease help

schema:
student(snum:int,sname:string,major:string,level:s tring,age:int)
class(name:string,meet_at:time,room:string,fid:int )
enrolled(snum:int,cname:string)
faculty(fid:int,fname:string,deptid:int)


2:Find the age of the oldest student who is either HISTORY MAJOR OR IS ENROLLED IN A COURSE TAUGHT BY I.tEACH.

Sol : select s.age from student s where s.age > = ALL (select s.age from student s1 ,enrolled e , faculty f where s.major = “ history” or f.fid = c.fid and e.cname = “ I.Teach”);
Reply With Quote
  #4 (permalink)  
Old 05-08-06, 14:45
krishna17 krishna17 is offline
Registered User
 
Join Date: Feb 2006
Posts: 18
hi

NOOOOOOO this is not an class assignment ...i am preparing for the finals...and I NEED HELP!!!!!!!!!!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On