Project 5-1: Creating Databases and Tables, based on p. 195 of the MCSA guide to
ID: 3800989 • Letter: P
Question
Project 5-1: Creating Databases and Tables, based on p. 195 of the MCSA guide to Microsoft® SQL server 2012 textbook.
This Critical Thinking Assignment requires you use the SQL Server instance named SQLSERVERHOA, and the HandsOnOne database and tables you created in Modules 1 and 3, respectively. The objective of this activity is to hone your skills at manipulating data using SQL DML statements. Use the Query Editor throughout this activity.
Construct and execute INSERT SQL statements to add the sample data in the following tables to the Customer and Address tables in the HandsOnOne database:
Additional Sample Data for Customer Table
CustomerName
CustomerAddressID
1
Western Supply Company
1
2
Nick Harper
3
3
Alice Harper
3
4
Abacus Consulting
4
Additional Sample Data for the Address Table
Street
City
State
Zip Code
1
2400 Broadway Drive
Missoula
MT
59802
2
320 21st Street
Billings
MT
59101
3
439 Skyline Blvd
Denver
CO
80002
4
56 Park Avenue
New York
NY
10001
Construct and execute a SQL query to list all customers with their corresponding cities and states. The list should be sorted in ascending numerical order by ZIP code, followed by customer name alphabetically. Take a screenshot of the Query Editor after you have executed this SQL command to show that it was completed successfully.
Construct and execute a SQL Query to list the Street, City, State, and Zip Code of all addresses that do not have a customer associated with them. Take a screenshot of the Query Editor after you have executed this SQL command to show that it was completed successfully.
Construct and execute a SQL query to count the number of customers in each state. The list should be ordered by the number of customers in descending order, then by zip code in ascending order. Take a screenshot of the Query Editor after you have executed this SQL command to show that it was completed successfully.
Construct and execute a SQL query to change Alice Harper’s address to 320 21st St, Billing, MT 59101. Take a screenshot of the Query Editor after you have executed this SQL command to show that it was completed successfully.
Construct and execute a SQL query to list the full names of all customers who have Harper in their name. Take a screenshot of the Query Editor after you have executed this SQL command to show that it was completed successfully.
Your final step in this assignment is to compose a report of 1-page minimum in length that outlines your experience completing this assignment. Which task was the most difficult for you? Which was the easiest? Your report should follow the CSU-Global Guide to Writing and APA.
Deliverable
After you have completed these steps, submit a single MS Word document that contains the screenshots and the written report. Insert all of the screenshots into the document, label each of them clearly, and include the information for the report below the screenshots.
CustomerID
CustomerName
CustomerAddressID
1
Western Supply Company
1
2
Nick Harper
3
3
Alice Harper
3
4
Abacus Consulting
4
Explanation / Answer
If you have any doubts, please give me comment...
CREATE TABLE Address(
AddressID INTEGER NOT NULL PRIMARY KEY,
Street VARCHAR(100),
City VARCHAR(50),
State CHAR(2),
ZipCode CHAR(5)
);
CREATE TABLE Customer(
CustomerID INTEGER NOT NULL PRIMARY KEY,
CustomerName VARCHAR(100),
CustomerAddressID INTEGER,
FOREIGN KEY(CustomerAddressID) REFERENCES Address(AddressID)
);
INSERT INTO Address VALUES(1, '2400 Brodway Drive', 'Missoula', 'MT', '59802');
INSERT INTO Address VALUES(2, '320 21st Street', 'Billings', 'MT', '59101');
INSERT INTO Address VALUES(3, '439 Skyline Blvd', 'Denver', 'CO', '80002');
INSERT INTO Address VALUES(4, '56 Park Avenue', 'New York', 'NY', '10001');
INSERT INTO Customer VALUES(1, 'Western Supply Company', 1);
INSERT INTO Customer VALUES(2, 'Nick Harper', 3);
INSERT INTO Customer VALUES(3, 'Alice Harper', 3);
INSERT INTO Cusotmer VALUES(4, 'Abacus Consulting', 4);
UPDATE Customer SET CustomerAddressID = 2 WHERE CustomerName = 'Alice Harper';
SELECT CustomerName
FROM Customer
WHERE CustomerName LIKE '%Harper%';
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.