---
--- Run this by typing
---    . set_environment
---    populate
---    query
---
--- Other queries to try :
---
---    mysql_registrar
---      select * from Course;
---      show columns from Course;
---      show tables;
---


--- Find all the students taking chemistry.
--- Sort them by phone number (hey - why not).
SELECT Person.name, Course.name
 FROM Person,Course,Registration,Status 
 WHERE 	Course.name         = 'chemistry' 
   AND  Status.name         = 'student'
   AND  Course.id           = Registration.course
   AND  Person.id           = Registration.person 
   AND  Registration.status = Status.id 
   ORDER BY Person.phone;

--- Find all the courses that Dr. Who is teaching.
SELECT Course.name, Person.name
 FROM Person,Course,Registration,Status 
 WHERE 	Person.name         = 'Dr. Who'
   AND  Status.name         = 'faculty'
   AND  Course.id           = Registration.course
   AND  Person.id           = Registration.person 
   AND  Registration.status = Status.id;


