|
|
Note that altogether this problem asks for a gigantic number of SQL queries. Feel free to pick and choose - you will get full credit if you write a reasonable fraction and variety of the queries. If you do them all, you will be a true SQL expert.
(i) Do parts (c) and (d) of Exercise 6.1.3 in the textbook (pages 252-253). Write the SQL queries only - you do not need to show the results on the sample data although you are free to do so if you wish. Note for part (c) that "any PC" should be taken to mean "some PC."
(ii) Do parts (c) and (e) of Exercise 6.2.2 in the textbook (pages 262-263). Write the SQL queries only - you do not need to show the results on the sample data although you are free to do so if you wish.
(iii) Do parts (b), (c), and (d) of Exercise 6.3.1 in the textbook (page 274).
(iv) Do Exercise 6.4.3 in the textbook (page 284) for your six queries (three parts, two queries each) from part (iii). We suggest that you do the "if so" part of the problem (rewriting to eliminate duplicates) but not the "if not" part of the problem (rewriting to eliminate subqueries), unless you are so inclined. A further exercise is to rewrite the queries using aggregation.
(v) Do parts (b), (d), and (g) of Exercise 6.4.6 in the textbook (pages 284-285). Write the SQL queries only - you do not need to show the results on the sample data although you are free to do so if you wish.
(vi) Do parts (b), (d), and (g) of Exercise 6.5.1 in the textbook (pages 290-291). Write the SQL modifications only - you do not need to describe the effects on the sample data although you are free to do so if you wish.
(a) Write an XPath expression to find the names of all stars whose street or city is "Hollywood."
(b) Write an XPath expression to find the titles of all movies made after 1975.
(c) Write an XPath expression to find all stars whose second listed movie has the word 'Strikes' in its title.
(d) Write an XQuery expression to find all pairs of star names where the two stars acted in a movie together. Assume that a movie is uniquely identified by its title. The elements in your query result should be of the form:
<Pair> <Name1>...</Name1> <Name2>...</Name2> </Pair>Stars should not be paired with themselves (you may assume that star names are unique), and each pair should occur exactly once, not once in each order.
(e) Write an XQuery expression to find the names of all stars who made at least one movie in a year earlier than the average year in the database.
|
select avg(GPA) from Student select sum(GPA)/count(*) FROM Student
|
Grades(name CHAR(15), course CHAR(9), year CHAR(2), quarter CHAR(6), grade CHAR(2))Load the data file into your Oracle table. Also make sure your Courses table from Project Part 1 is created and loaded as part of the same database. Now you have two tables with an attribute course that joins them. Using sqlplus, execute a few SQL queries and modifications over these two tables. You will want to refer to the document Oracle 9i SQL (available through the course Web site Project page) for details of Oracle's SQL quirks.
Create a transcript that shows the successful creation and loading of the Grades table, as well as the execution of at least two SQL queries involving both tables, and one SQL modification (insert, delete, or update) on each table.
In addition to the various help documents and Web sites mentioned in Assignment #1, you will find the following documents useful for this part of the project:
You may continue to use the small database we are providing, with the Grades table in addition to the Courses table enabling somewhat more complex queries. (If you prefer to create and use a different database you are welcome to do so.) Your extended Web front-end and connection to Oracle should include at least the following features:
drop table T;If you want to get rid of all tuples in T without deleting the table itself, issue the command:
delete from T;
When the preapproval process is not followed, projects that have problems on the Sweet Hall Solaris Netscape browsers may lose points, possibly all points if we cannot run your Web interface at all.