Take Assessment: Exercise 1
Take Assessment: Exercise 1
Design the following two tables and turn in your submissions in an HTML file named BookPublisher.html.
BOOK:
• Primary Author
• Title
• ISBN
• PublisherID
• Edition
• Date of Publication
• Price
• Book Description
PUBLISHER:
• PublisherID
• Name
• Address
Part I
1. Identify the keys in your tables as follows. For this exercise, ignore the performance considerations while
choosing your keys.
1. For each table, indicate the Primary Key(s) (PKs). If there is no PK, state so. Fully justify your
answer.
2. For each table, indicate the Alternate Key(s) (AKs). If there is no AK, state so. Fully justify your
answer.
3. For each table, identify the Foreign Key(s) (FKs) and the integrity constraints. Fully justify your
answer.
2. List all columns of your tables, and the domains (the data types and formats) of these columns. Fully
justify your answer.
In an HTML table, list at least 4 rows with valid values in each of the tables. Turn in your submission the file
BookPublisher.html
Part II
Write SQL statements as specified below. Help on setting up your DBMS is available here. Submit your SQL
statements in a file named createDB.sql
1. Write the DDL statements to create the two tables using the CREATE TABLE statement. Be sure to
identify your primary keys and alternate keys in the statement.
2. Write the INSERT statements to insert the 4 rows into each table.
3. Write the SQL statement to retrieve the title and price of all books published by either of two publishers
(say "Addison Wesley" and "McGraw Hill"). In the file Rel-ops.txt, list which relational operations you
used, from among the select/project/join operations, in order to perform this query. Explain the role of
each operation in your query.
4. Write the SQL statement to retrieve the Publisher name of a particular book title (say "Fundamentals of
Database Systems").
Part III
1. In "1.2.2 Relational Operations," there was an example of the set difference operation: the result of r - s
was provided to you. Provide the result of the set difference operation s - r.
2. In the class notes, the following UNION example was discussed. If the UNION were replaced by the
phrase EXCEPT, state in plain English the results that will be retrieved by the query.
3. ( SELECT MemNo
4. FROM MEMBER, BOOK
5. WHERE MemNo = BorrowerMemNo AND
6. CallNumber = 'QA76.9.D26C66'
7. )
8. UNION
9. ( SELECT MemNo
10. FROM MEMBER, BOOK
11. WHERE MemNo = BorrowerMemNo AND
12. CallNumber = 'QA76.9.D7E53'
13. );
Your submission for this exercise should consist of the following files: BookPublisher.html and createDB.sql,
Rel-ops.txt, and part3.txt.
To help yourself do your best on this assessment, consult this general list of grading guidelines.
Take Assessment: Exercise 2
Exercise 2: SQL
Run the SQL script given to you to create a Library database. Note that each row in the Book table denotes a
book copy. Thus, if the library carries 3 copies of the title "DBMS", there will be 3 rows in the Book table, one
for each copy. Write the SQL statements to do the following against the database (Note: You must express your
query in a single SQL statement for each of the following. However, that statement could have sub-queries.):
1. List the titles of all books written by "Churchill," along with their Year of Publication.
2. Retrieve the titles of all books borrowed by members whose first name is "John" or "Susan".
3. List the names and IDs of all members who have borrowed the "Iliad" and the "Odyssey"—both books.
4. List the names and IDs of all the members who have borrowed all titles written by "Collins.". Assume
that a member may have borrowed multiple copies of the same title.
5. Find the phone numbers of all members who have borrowed a book written by an author whose last
name is "Tanenbaum."
6. Find those members who have borrowed more than 3 books and list their names, IDs, and the number of
books they borrowed. Sort the results in descending order based on the number of books borrowed.
7. List all members who have not borrowed any book.
8. List in alphabetical order the first names of all the members who are residents of Pittsburgh (Phone
numbers starting with "412") and who have not borrowed the book titled "Pitt Roads."
To help yourself do your best on this assessment, consult this general list of grading guidelines.
Take Assessment: Exercise 3
For this exercise, we will use the following library schema. It includes information about book titles in the
library, information about library members, about the number of times the books were read by members, about
the suppliers who supply books to the library, and about orders placed with the suppliers. To distinguish the
table names used in this exercise from the table names in other exercise, each table name in this exercise ends
with the character '4'.
Point of clarification: The ReceivedDate column refers to the date when the Order was received by the system
(i.e., recorded in the database). It does not refer to the date a consumer received the items ordered by him.
A series of CREATE TABLE and INSERT statements have been given to create a database. In order not to erase
any existing tables, make sure you run the DDL statements in an empty database (a database that contains no
prior tables).
1. delete_rows.sql
2. alter_tables.sql
3. queries.sql
To help yourself do your best on this assessment, consult this general list of grading guidelines.
Take Assessment: Exercise 4
Exercise 4
Design the look of various screens of your E-Store interface by creating all the HTML pages. A description of
the E-Store project you are to implement is given in the Appendix. For this exercise, you should design all the
HTML pages required by the E-Store specified in the Appendix (not just the screenshots given in the Appendix).
Your HTML pages need not contain the code necessary to access the database. However, your html pages
should include all buttons and links that will be clickable in the final implementation of the system. You can
hardcode some dummy data into your HTML pages as placeholders, if necessary. Point the links to the relevant
html pages, such that clicking on the links will bring up appropriate html pages containing some dummy data.
Identify those links and buttons that, when clicked, will initiate access to the database.
For example, among the many html pages you will turn in, let us look at the details of three pages: the search
page, the search-results page, and the book-details page. The search page should have a textbox for the user to
fill in the search criteria, among other things. It should also have a button next to the textbox. In the final
implementation, clicking the button will initiate a database search, but it will not do so after you have completed
this present exercise. For this exercise, clicking the button will simply bring up the search-results page that
contains hard-coded data for some books. Irrespective of the search criteria, the same set of books will be shown
in the search-results page. Each book in the search-results page will be a hyperlink. Clicking the hyperlink on a
book will bring up another page that contains more book details. Again, for this exercise, details of the same
book will be shown, irrespective of the book clicked.
Create a small database using the SQL code given. Design a web site that will search for a member with a
specified phone number. Your site should have 2 pages:
1. One page that has a textfield for the user to type in a member's phone number, and a button to click.
2. Upon clicking, the system should search the database and display all members with that phone number in
a second page.
More help on connecting your database to the web is available from a number of places. Turn in all the relevant
files.
To help yourself do your best on this assessment, consult this general list of grading guidelines.
Take Assessment: Exercise 5
Exercise 5: ER Models
Create the complete ER schema for your E-Commerce database from the specification given in Appendix. Note
that the specification is from a user's point of view, and hence does not tell you all of the keys (primary and
alternate), all of the relationships, and the arity of relationships, etc. You should identify them.
Make reasonable assumptions to make the specification complete. Explicitly state all your assumptions. EVERY
construct in your ER schema should be substantiated by either the specification above or your explicit
assumptions.
Use the ER diagramming notations to draw your schema. Turn in your ER schema in a file named ER.gif, and
the attribute list in a text file named ER.txt
To help yourself do your best on this assessment, consult this general list of grading guidelines.
Take Assessment: Exercise 6
Exercise 6: Normalization
Provide your solution to the following in a file named normalization.txt . Note: The discussion in this exercise is
independent of (i.e., completed unrelated to) the E-Commerce project described in the Appendix.
The following table captures the following fact about an E-Commerce bookstore: the employee whose name is
EmpName and whose ID is EmpID has shipped the order (whose Order Number is OrderNo ) to the address
ShipToAddr on the date ShippedDate. The tracking number for the shipment is TrackingNum. The
TrackingNum is provided by the courier company that picks up the shipment. The bookstore uses only one
courier company. Note that a single order could be split up into multiple shipments based on the availability of
the ordered items. Only one employee handles a shipment. However, multiple employees could handle an order
if the order is shipped in multiple shipments.
That is, if the relation is in an unnormalized form, you would explain the transformation you performed
to bring it to 1st, 2nd and 3rd normal forms. You would also provide the table structure, the primary key
and the FDs for the 1st, 2nd, and 3rd normal forms. You would also provide explanation for why you
believe it is in 1st, 2nd and 3rd normal forms.
1. normalization.txt
To help yourself do your best on this assessment, consult this general list of grading guidelines.
Take Assessment: Exercise 7
Exercise 7: ER Mapping
Map your ER schema into a relational database schema, using the mapping algorithm. Express the resulting
relational database schema, using the following notation: PK for Primary Key, AK for Alternate Key, and FK for
Foreign Key with an arrow to corresponding Table(Primary key) as given below. Show the results of your work
for each step of the mapping algorithm. Submit your work in a file called relational-schema.txt.
Code your relational schema using CREATE TABLE statements. Notice that this set of statements should
specify the integrity constraints: keys, relationships, etc. Submit your CREATE table statements as a text file
named relational-model.sql.
1. relational-schema.txt
2. relational-model.sql
To help yourself do your best on this assessment, consult this general list of grading guidelines.
Take Assessment: Exercise 8
Exercise 8
Complete your E-Commerce project ( as specified in Appendix). It should have all the functionalities mentioned
in the project description document. Turn in all the relevant files and the SQL statements to create your initial
database.
Use "prxyuser" as the username and "prxypass" as the password in your ConnectionString. Name your database
as bookstore.
Package and compress all your files into one file using WinZIP, or some other utility or combination of utilities.
tar and gzip are freeware utilities you can download from the web that will help you package and compress
multiple files into one file.
In exam3, you might be asked to extend your E-Commerce project implementation. Instead of extending your
implementation, you could extend the sample library project. Make sure you have the skills to build a web-based
database application. The best way to master the skills and be prepared for exam3 is to complete your project.
To help yourself do your best on this assessment, consult this general list of grading guidelines.