The problems refer to an AIRLINE database similar to the one defined in problem 7.21 of the text. The changes in the database schema were done to make a better database design. To make yourself a copy of this database in Sybase, use isql and the stored procedure OSUsp_CopyAirline. If you want to restore your copy to its original data, first delete it by using OSUsp_ClearAirline and then recreate it using OSUsp_CopyAirline.
For these problems you will need to submit your answers, i.e. SQL queries/commands, electronically. This submission will be done using the submit command. You should submit two files: hw1.txt (answers to problem 1) and hw1.sql (answers to problems 2-4). See the next page for details on how to submit files.
For the more complex queries, you may want to create intermediate views to break the problem into simpler parts.
All processing for these queries should be done in your select statements. That is you should not look up some data in the database and then use that data to simplify your query.
Give four different answers for this problem:
(Note that "select * from A where (a,b) in select (a, b) from B where condition" is not allowed. Only a single field is allowed.)
AIRLINES(AIRLINE, AIRLINE_NAME)Specify the create table statement needed to create this table. Assume AIRLINE_NAME is a character string of up to 30 characters. Insert the following data into the table.
AIRLINE AIRLINE_NAME US US Airways TWA Trans World Airline
Print out the resulting table.
How to Run and Submit Your Solution to Homework 1
``isql'' can be used in batch mode. That is create a file called hw1.sql and use that file as input to isql as follows:
where the file hw1.sql has the following format:isql -P yourpassword < hw1.sql
Note that each query is labeled with a comment identifying the question number. Also note that a go command appears after each query. As with other Unix commands, isql treats the file hw1.sql as if it were data typed as input. The use of redirected input means that you cannot type your password as input. Thus you must put it in the command line.OSUsp_ClearAirline go OSUsp_CopyAirline go /* 2 */ /* a */ select ... from ... ... go /* e */ select ... from ... ... go /* 3 */ /* a */ delete from ... where ... ... go ... drop table ...
You are to submit the files hw1.txt and hw1.sql. The class name is c671aa and the subdirectory is called hw1. The submit command should be used as follows:
submit c671aa hw1 hw1.txt hw1.sql