Assignment 1: SQL Queries
Due: Wednesday, September 27, 1996, at 5 p.m.
Instructor: Raghu Ramakrishnan
The relations for this assignment are in a database called raghu564, and have the following schemas:
Student(Snum, Name, Major, Level, Age)The keys are in italics. The meaning of these relations is straightforward; for example, Enrolled has one record per student-class pair such that student is enrolled in class. They were created using the following SQL statements:
Class(Name, Time, Room, Fid)
Enrolled(Snum, ClassName)
Faculty(Fid, Name, Dept)
- CREATE TABLE Student (
- Snum int,
- Name char(10),
- Major char(10),
- Level char(2),
- Age int );
- CREATE TABLE Class (
- Name char(10),
- Time char(10),
- Room char(10),
- Fid int );
- CREATE TABLE Enrolled (
- Snum int,
- ClassName char(10)
- );
- CREATE TABLE Faculty (
- Fid int,
- Name char(10),
- Dept char(10)
- );
Using the database raghu564, write the following queries in SQL. No duplicates should be printed in any of the answers.
You are to hand in a script of a session on SYBASE with your queries and the answers. To do this, you will start script to generate a script file and pipe the query file to the SQL interpreter. The queries and results will be recorded in the script file which you will then hand in. (See the accompanying information sheet on using SYBASE for more details on how to do this.)