Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Assignment 1: Basic SQL
1. Write the following simple SQL Queries on the
University Schema
1. Find the names of all the students whose
total credits are greater than 100 2. Find the course id and grades of all courses taken by any student named 'Tanaka' 3. Find the ID and name of instructors who have taught a course in the Comp. Sci. department, even if they are themselves not from the Comp. Sci. department. To test this query, make sure you add appropriate data, and include the corresponding insert statements along with your query. 4. Find the courses which are offered in both 'Fall' and 'Spring' semester (not necessarily in the same year). 2. Optional
1. Find the names of all the instructors
from Comp. Sci. department 2. Find the course id and titles of all courses taught by an instructor named 'Srinivasan' 3. Find names of instructors who have taught at least one course in Spring 2009 3. The Next task is to Create the Railway schema using the commands in the Railway DDL script; the commands can be copy-pasted into pgAdmin3. The DDL script also contains a description of the railway schema. Refer to that for clarity. 1. Insert sample data using the command in the file SampleRailwayData. 2. Try inserting more data into these tables. Refer to the populate script above for examples.
4. Write the following Queries for Railway Schema
1. Find pairs of stations (station codes) that have a track (direct connection) with distance less than 20Kms between them. 2. Find the IDs of all the trains which have a stop at THANE 3. Find the names of all trains that start at MUMBAI. 4. List all the stations in order of visit by the train 'CST-AMR_LOCAL'. 5. Find the name of the trains which have stop at Thane, before the 6th station in the route of the train.