11/20/2018 MIST.3030 Database Management Systems by Xiaobai Li 1
11/20/2018 MIST.3030 Database Management Systems by Xiaobai Li 1
3. (8 points) Create a view using the dbo’s tables (and name it LargeOrders), which includes
OrderID, CustomerID, ProductID and Quantity for orders of more than three units. Turn in both the
SQL statement and the output results
SQL Statement:
Output:
4. (12 points) Create an updateable view, named ProductDescriptionV, which includes ProductID
and ProductDescription values for all products. Add a new product with ProductID = 101 and
ProductDescription = ‘Bookshelf’ to the view. Print out the results before and after the update.
Turn in the SQL commands for creating and updating the view.
SQL Commands:
11/20/2018 MIST.3030 Database Management Systems by Xiaobai Li 2
Before update:
SQL to update:
After update:
11/20/2018 MIST.3030 Database Management Systems by Xiaobai Li 3
5. (12 points) You need a partner to complete this problem. Please type or write your partner’s name
on the page for this problem.
a. Grant the SELECT permission on your four PVF tables to your partner. Print out your SQL
statements.
b. Ask your partner to grant the SELECT permission on his/her PVF tables to you. Then write a
query based on your partner’s tables to find out CustomerID, Name, OrderID and OrderDate
for those customers who placed orders in November, 2018. Print out your SQL statement and
the results. [Note: In SQL Server, use a pair of single quotes for the values of a Date type; the
MS-Access syntax (#) won’t work in SQL Server.]
SQL:
11/20/2018 MIST.3030 Database Management Systems by Xiaobai Li 4
Output:
if @@error > 0 …
else …
Show the whole process in your solution. Display the table’s contents before and after the
transaction using “select CustomerID, Name from MyCustomer;” (instead of opening
the entire Customer table).
Before the transaction:
SQL:
11/20/2018 MIST.3030 Database Management Systems by Xiaobai Li 6
Output: