Fill This Form To Receive Instant Help
Homework answers / question archive / Database Development Assignment: Create and Populate a Database using SQL Creating a small author-article-publication database In this assignment, we’ll follow the database design process with a step-by-step example
Database Development Assignment: Create and Populate a Database using SQL
Creating a small author-article-publication database
In this assignment, we’ll follow the database design process with a step-by-step example. Your client, Wellness Week is a small, specialized publisher that publishes articles on health and wellness issues. The owner would like to have a small database that would track authors and articles.
Phase 1: AnalysisDuring the analysis phase the database designer will ask questions of the various stakeholders to try to get as complete a view as possible of the business requirements. It is very important at this stage not to limit interviews and interactions with a select few users or a subset of users. The director’s needs of the database, for example, might be quite different from someone who interacts regularly with authors.
The designer might ask questions like
Below are some of the findings from the analysis phase. If you have additional questions or need clarification, do not hesitate to ask your instructor.
Would publisher be an entity? The answer is no, but if you are unsure of why not, ask your instructor!
Now we can begin to consider the relationship between the various entities.
We can further take a first shot at the following attributes:
author |
article |
The Entity Relationship Diagram might look like this:
publication |
There is ONE many-to-many relationship in the figure above. As explained in the Relationships Among Entities document, many-to-many relationships must be converted into one-to-many relationships so they can be implemented in a DBMS. An intersection entity between Article and Publication should be created. We’ll call it article_pub.
author |
article |
article_pub |
publication |
The next step in the design phase is to develop the logical and physical design. Here we’ll add attributes and create relationships between the entities and specify primary keys.
Database Name: wellness_week |
author |
|
Field |
Definition/Type |
authorId |
primary key, integer |
firstName |
text |
lastName |
text |
address |
text |
city |
text |
state |
text |
zip |
Text |
telephone |
Text |
|
Text |
article |
|
Field |
Definition/Type |
articleId |
primary key, integer |
Title |
Text |
authorId |
foreign key, integer |
Length |
Integer |
|
|
article_pub |
|
Field |
Definition/Type |
articleId |
joint primary key, foreign key, integer |
publicationId |
joint primary key, foreign key, integer |
|
|
|
|
|
|
Note the Khan Academy SQL emulator we are using, the New SQL script page, may not accept joint primary keys and may give an error when defining a foreign key. For the purposes of this exercise, for the article_pub table, you can simply create the table WITHOUT defining any primary key.
publication |
|
Field |
Definition/Type |
publicationId |
Primary key, integer |
Title |
text |
publicationDate |
text |
|
|
|
|
Part 1 of the assignment (40%):
During the tutorials you’ve taken in this course, you have seen databases created at various stages. You have not, however, seen a database created from beginning to end. Looking back at the tutorials and SQLite documentation, your task is to write the SQLite code to create the database described here. It should attend to all business specifications described in this document.
The code must be in SQLite, the version of SQL you have been using in the Khan Academy tutorials. If you simply do a search for ‘SQL’ ‘create database’, you will just as likely find some other flavor of SQL such as MySQL or PostgreSQL.
You can use this New SQL script page at Khan Academy to test your work:
https://www.khanacademy.org/computer-programming/new/sql
Additional instructions:
This is text that can be cut and pasted (comments not required):
/* begin SQLite code */
CREATE TABLE customers (id INTEGER PRIMARY KEY, name TEXT, age INTEGER, weight REAL);
INSERT INTO customers VALUES (73, "Brian", 33, 50);
/* end SQLite code */
This is a screenshot that cannot be cut and pasted:
One could argue that Testing should logically occur before Implementation, since for many ‘Implementation’ implies ‘roll out’ of the database. Whichever order you put them in, testing is essential BEFORE the database bears the full brunt of hundreds or thousands of concurrent connections and the demands of users.
Before the system has been populated with data, it is still theoretically possible to change the underlying schema of the database. Not always easy, but possible. Once the database has been populated with data, this becomes much more difficult, even impossible in certain situations.
Maintenance, including working on keeping up the efficiency and speed of the database in the wake of updates and deletes, is an on-going task. Backing up a database is obviously important and accepting that occasionally full or partial restores of a data base will be necessary.
Part 2 of the assignment (40%):
When you have successfully constructed the necessary code to create the database in SQL, you should populate the database with sample data of your choice, again using SQLite code. Note that the data need not be ‘real’, but should be realistic. For example, 177 Arbor Hill Drive, Silver Spring, MD 20903 is not a real address, but is realistic. 137 Abcdefg Avenue, Qwerty, KY 12345 is not realistic.
Your data should have a minimum of 5 authors, 5 articles and 2 publications. Otherwise follow any rules listed earlier in the Design phase.
As with Part 1, you may use the New SQL script page at Khan Academy to test your work:
https://www.khanacademy.org/computer-programming/new/sql
Part 3 of the assignment (Maintenance) (20%):