Competencies
In this project, you will demonstrate your mastery of the following competencies:
- Create a structured database through the use of relational concepts
- Implement basic processing functionalities to create new structured database environments
Step One: Scenario
You’re working as a database administrator for Quantigration, a networking equipment manufacturer. The company has grown quickly, and it’s still figuring out its internal business processes. Customer return merchandise authorizations (RMAs) are used to track shipments for defective or incorrect parts. The company has identified RMAs as a specific problematic area.
Your supervisor at Quantigration asked you to create a database for a new software application that will be used for processing RMAs. Because there are several locations where merchandise can be taken in, the application must also record where items are received. This system will also capture where the equipment is going next: repair, scrap, or refurbishing and resale. The warehouse shipping and receiving employees at your company will be using this application; they are considered your “end users” for the application. Part of their job is to process customer return shipments. This involves the following steps:
- Assess the quality of the items being returned for defects
- Identify missing parts
- Identify signs of obvious wear and tear (such as dents or scratches to the equipment)
Step One: Directions
Create a Database
The data architect on your DevOps team has come to you with a logical database diagram referred to as an entity relationship diagram (ERD). This is documentation of the tables, their relationships to each other, their attributes, and any primary or foreign keys on those attributes. These elements are required to create the new database.
Prior to beginning, review the example ERD in the Quantigration RMA Diagram document in Supporting Materials.
Create your three tables, namedCustomers,Orders, andRMA, in theQuantigrationUpdatesdatabase based on the example you‘ve been given. To do this, complete the following steps and place your work in the provided Database Documentation Template:
- Navigate to your online integrated development environment (IDE). The next set of steps will help youwrite SQL commands to create tablesthat demonstrate relationships based on the ERD.
Create a database schemacalled QuantigrationUpdates that will hold tables by using SQL commands. List it out to the screen.
- Using the ERD as a reference,create the following tables with the appropriate attributes and keys:
- A table to store customer information with a primary key of Customer ID
- A table to store order information with a primary key of Order ID and a foreign key of Customer ID
- A table to store RMA information with a primary key of RMA ID and a foreign key of Order ID
- Because of a new company branding initiative, you’ve been asked to change the name of the “Customer” to “Collaborator.”Update your existing table using SQLbased on this change in requirements.Copy and paste the SQL you write to do the following:
- Rename all instances of “Customer” to “Collaborator.”
STOP:Make sure to save your work before moving on toStep Twoof this process. You’ll continue to work in Codio and use the documentation you started inStep One.
Step Two: Scenario
Now it’s time to populate the database with records and run some basic queries against those tables. You’ll be using theQuantigrationUpdatesdatabase and the three tables you created inStep Oneto do the following:
- Import data from the CSV data files into the tables
- Perform queries against those tables
- Create an output listing to the screen of the query results
The shipping and receiving team that you are working with has been keeping records of their RMAs in spreadsheets, and your team has been creating its database in MySQL. The information that they have is detailed and won’t need cleaning. The data in the tables can be exported to CSV files. The data should also align with the columns and data types in your tables.
Step Two: Directions
Load and Query the Data
In Step One, you created a customer RMA database using SQL to create tables and placed your work in the database documentation template. To complete your objectives in this step, continue to place your work in the database documentation template and follow these directions:
- Please note before you begin that the three data files being used for this project are preloaded into Codio:
- RMA.csv
- Customers.csv
- Orders.csv
Import the datafrom each fileinto tables.
- Use the QuantigrationUpdates database, the three tables you created, and the three CSV files preloaded into Codio.
- Use the import utility of your database program to load the data from each file into the table of the same name. You’ll perform this step three times, once for each table.
Write basic queriesagainst imported tables to organize and analyze targeted data.For each query, include a screenshot of the query and its output. You should also include a 1- to 3-sentence description of the output.
- Write an SQL query that returns the count of orders for customers located only in the city of Framingham, Massachusetts.
- This query will use a tablejoinbetween theCustomersandOrderstables. The query will also use aWHEREclause.
- How many records were returned?
- Write an SQL query to select all of the customers located in the state of Massachusetts.
- Use a WHERE clause to limit the number of records in the customers table to only those who are located in Massachusetts.
- Record an answer to the following question: How many records were returned?
- Write an SQL query to insert four new records into the orders and customers tables using the following data:
- Customers Table
- Create a table that contains the following columns: CustomerID, FirstName, LastName, StreetAddress, City, State, ZipCode, Telephone
- Then, populate the columns with the information of 20 additional “Customers.”
Customers Table
CustomerID
|
FirstName
|
LastName
|
StreetAddress
|
City
|
State
|
ZipCode
|
Telephone
|
---|
100004 |
Luke |
Skywalker |
15 Maiden Lane |
New York |
NY |
10222 |
212-555-1234 |
100005 |
Winston |
Smith |
123 Sycamore Street |
Greensboro |
NC |
27401 |
919-555-6623 |
100006 |
MaryAnne |
Jenkins |
1 Coconut Way |
Jupiter |
FL |
33458 |
321-555-8907 |
100007 |
Janet |
Williams |
55 Redondo Beach Blvd |
Torrence |
CA |
90501 |
310-555-5678 |
Orders Table
OrderID
|
CustomerID
|
SKU
|
Description
|
---|
1204305 |
100004 |
ADV-24-10C |
Advanced Switch 10GigE Copper 24 port |
1204306 |
100005 |
ADV-48-10F |
Advanced Switch 10 GigE Copper/Fiber 44 port copper 4 port fiber |
1204307 |
100006 |
ENT-24-10F |
Enterprise Switch 10GigE SFP+ 24 Port |
1204308 |
100007 |
ENT-48-10F |
Enterprise Switch 10GigE SFP+ 48 port |
- In the Customers table, perform a query to count all records where the city is Woonsocket, Rhode Island.
- How many records are in the customers table where the field “city” equals “Woonsocket”?
- In the RMA database, update a customer’s records.
- Write an SQL statement to select the current fields ofstatusandstepfor the record in the RMA table with anOrderIDvalue of “5175.”
- What are the current status and step?
- Write an SQL statement to update thestatusandstepfor theOrderID, 5175 tostatus= “Complete” andstep= “Credit Customer Account.”
- What are the updatedstatusandstepvalues for this record? Provide a screenshot of your work.
- Delete RMA records.
- Write an SQL statement to delete all records with a reason of “Rejected.”
- How many records were deleted? Provide a screenshot of your work.
Create an output fileof the required query results.Write an SQL statement to list the contents of theOrderstable and send the output to a file that has a .csv extension.
What to Submit
To complete this project, you must submit the following:
Database Documentation
Complete and submit theDatabase Documentation Template. This will be where you capture the work that you’ve done in both Step One and Step Two. Follow the specific instructions for the directions outlined here and within the template itself.
Supporting Materials
The CSV data files that you’ll be working with can be found in Codio. They are listed vertically in the left pane of your Codio web interface. The following resource(s) may support your work on the project:
Document:
Database Documentation Template Example
As you complete your database documentation template, refer to this document for an example of how to insert screenshots to capture your work.
Document:
Quantigration RMA Diagram
This ERD shows the relationships of entities in the database. Download this ERD and use it to support your work on this project. A text version of the diagram is available:Quantigration RMA Diagram Text Version.