Student and their Department Based on City
Write a query to display list of students name and their department name who are all from 'Coimbatore'. Sort the result based on students name
(HINT: Use department and student tables to retrieve records.)
Solution:
SELECT STUDENT.STUDENT_NAME,DEPARTMENT.DEPARTMENT_NAME FROM STUDENT,DEPARTMENT WHERE DEPARTMENT.DEPARTMENT_ID=STUDENT.DEPARTMENT_ID && CITY='Coimbatore'
ORDER BY STUDENT.STUDENT_NAME;