Unformatted text preview:

CS 3335Exam ISept. 26, 2008100 points Name:For all queries, provide docuementation and label all output columns appropriately. Usethe stock prices schema we have used in class (it is included on the last page for yourconvenience). MAKE NO ASSUMPTIONS ABOUT THE DATA! Unless otherwisespecified in the question, all answers should be a single SQL query.1. (10)Using join predicates in the where clause, find the name of all customers who sold astock with the symbol ’QQQQ’ on a day when the closing price was above 100. Alsoreturn the day of the transaction.2. (10)Answer Question 1 using the JOIN operator and NO join predicates in the where clause.3. (20)Using derived relations, find the names of all customers who have sold more shares ofa stock than they have bought. Include the stockid in the result. Remember that acustomer selling stock without buying it should be in the result.Page 24. (10)Every customer named Casey Customer bought 100 shares of Microsoft Corp stock onSeptember 24, 2009 at the closing price. The commission was 2%. Update the sto ckpricestable to represent this purchase.5. (10)Casey Customer turned out to be a fraud! Delete him and all of his transactions fromthe database. You may use multiple SQL statements, but do not violate any consistencyconstraints.Page 36. (20)List all states where ever y customer from that state has made at least 3 transactions.Page 47. (3)Why is it good practice to close Connection, Statement, and ResultSet obj ects even-though they are automatically closed?8. (3)What is the default behavior for MySQL for returning results after executing a query ina JDBC program?9. (4)According to the Java API, how is the boolean value r eturned by the ResultSet methodnext() determined?Page 510. Let table T have only 1 attribute, A. Let table S have only 1 attribute, also A. In tableT, there are 5 rows and in table S there are 3 rows. Every row in every table has thevalue 7. How many rows are returned for each query? Each part is worth 1 point.(a) (Select A from T) EXCEPT (Select A from S)(b) (Select A from T) EXCEPT ALL (Select A from S)(c) (Select A from T) INTERSECT (Select A from S)(d) (Select A from T) INTERSECT ALL (Select A from S)(e) (Select A from T) UNION (Select A from S)(f) (Select A from T) UNION ALL (Select A from S)11. (4)If the querySelect * From table1, table1;returns 100 rows, the querySelect * from table1 Natural Join table1;returns how many rows?Page


View Full Document

BAYLOR CSI 3335 - exam1

Documents in this Course
Load more
Download exam1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view exam1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view exam1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?