Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a new Microsoft Access database named DryCleaning. Note that Microsoft Ac

ID: 3773052 • Letter: C

Question

Create a new Microsoft Access database named DryCleaning.
Note that Microsoft Access does not support the use of SQL scripts to create databases. In a Microsoft Word document, type the SQL script that you would use to create the database.

Add a table named Customers. In Microsoft Word, type the SQL script that you would use to create the table. Include the following fields:

CustomerNumber (AutoNumber, Primary Key, required)

FirstName (Text(25), required)

LastName (Text(25), required)

Phone (Text(12), required)

Email (Text(100))

Add a table named Invoice. In Microsoft Word, type the SQL script that you would use to create the table. Include the following fields:

InvoiceNumber (Number-Long Integer, required, Primary Key)

CustomerNumber (Foreign Key, Number-Long Integer, Required)

DateIn (Date/time, required)

DateOut (Date/time)

TotalAmount (Currency)

Add a table named Invoice_Item. In Microsoft Word, type the SQL script that you would use to create the table. Include the following fields:

ItemNumber (AutoNumber, Primary Key, required)

InvoiceNumber (Foreign Key,Number-LongInteger, required)

Item (Text(50), required)

Quantity (Number-Long integer, required)

UnitPrice (Currency, required)

Write INSERT statements to add the data provided below to the tables

In one Word document

paste the SQL statement to meet the following criteria. Put a title above each as stated and save each query with the title name. You will add needed documentation from Part II to this document.

List the phone and last name of all the customers. Titled this01CustomerPhone-LastName

List the phone and last name of all the customers with the first name "Nikki." Titled this 02NikkiPhoneLastName

List the phone, first name, and last name of all the customers having phone numbers with "2" and "3" as the second and third numbers, respectively. Titled this 03PhoneWith?23.

Determine the maximum and minimum total amount. Save As04AverageTotalAmount.

Show the first and last names of all the customers who have had an order with total amount greater than $100.00. Use a subquery and present the results first sorted by last names in the ascending order and then by first names in the descending order. Titled this05CustomersTotalAmountGreaterThan100.

From the Customers table, concatenate each customer's last name and first name by using the comma-space-delimited technique; name the virtual column as "Full Name.” Titled this06CustomerLastFirstNamesConcantenated.

Use a subquery to show the first and last name of all the customers who have had an order with an item named "Dress Shirt". Present the results first sorted by last name in the ascending order (Titled this07FirstLastNamesDressShirtSortedLastName) and then by first name in the descending order. Titled this08FirstLastNamesDressShirtSortedFirstNameDescending.

Use a join with a subquery to show the first name, last name, and total amount of all the customers who have had an order with an item named "Dress Shirt". Present the results first sorted by last name in the ascending order (Titled this09FirstLastNamesDressShirtSortedLastNameWithTotal) and then by first name in the descending order. Titled this10FirstLastNamesDressShirtSortedFirstNameDescending

Calculate the average total amount. Titled this 11AverageTotalAmount.

Explanation / Answer

1) Create a new Microsoft Access database named DryCleaning.

CREATE DATABASE [DryCleaning];

2) Add a table named Customers.

CREATE TABLE Customers (

CustomerNumber Numeric NOT NULL

FirstName Char (25) NOT NULL

LastName Char (25) NOT NULL

Phone Char (12) NOT NULL

Email Char (100) NULL

CONSTRAINT CustomerNumber PK PRIMARY KEY(CustomerNumber)

);

3) Create Table Invoice

CREATE TABLE Invoice (

InvoiceNumber Numeric NOT NULL

CustomerNumber Char (25) NOT NULL

DateIn DateTime NOT NULL

DateOut DateTime NULL

TotalAmount Money NULL

CONSTRAINT InvoiceNumber PK PRIMARY KEY(InvoiceNumber)

CONSTRAINT CustomerNumber FK FOREIGN KEY(CustomerNumber)

);

4) Create Invoice_Item

CREATE TABLE Invoice_Item (

ItemNumber Numeric NOT NULL

InvoiceNumber Numeric NOT NULL

Item Char (50) NOT NULL

Quantity Numeric NOT NULL

UnitPrice Money NOT NULL

CONSTRAINT ItemNumber PK PRIMARY KEY(ItemNumber)

CONSTRAINT InvoiceNumber FK FOREIGN KEY(InvoiceNumber)

);

SQL Query

List the phone and last name of all the customers.
SELECT Phone, LastName
FROM Customers;

List the phone and last name of all the customers with the first name "Nikki."
SELECT Customers.Phone, Customers.LastName
FROM Customers
WHERE (((Customers.[First Name])="Nikki"));

List the phone, first name, and last name of all the customers having phone numbers with "2" and "3" as the second and third numbers, respectively.
SELECT Customers.[First Name], Customers.LastName, Customers.Phone
FROM Customers
WHERE (((Customers.Phone)="*?23*"));

Determine the maximum and minimum total amount.
SELECT MIN (TotalAmount) AS MinAmount, MAX (TotalAmount) AS MaxAmount
FROM Invoice;

Show the first and last names of all the customers who have had an order with total amount greater than $100.00. Use a subquery and present the results first sorted by last names in the ascending order and then by first names in the descending order.
SELECT Customers.[First Name], Customers.LastName, Invoice.TotalAmount
FROM Customers INNER JOIN Invoice ON Customers.CustomerNumber = Invoice.CustomerNumber
WHERE (((Invoice.TotalAmount)>100))
Order By Customers.LastName, Customers.[FirstName] DESC ;

From the Customers table, concatenate each customer's last name and first name by using the comma-space-delimited technique; name the virtual column as "Full Name.”
SELECT Customers.[First Name] & ' ' & [LastName] AS [Full Name]
FROM Customers;

Use a subquery to show the first and last name of all the customers who have had an order with an item named "Dress Shirt". Present the results first sorted by last name in the ascending order
FROM (Customers INNER JOIN Invoice ON Customers.CustomerNumber = Invoice.CustomerNumber) INNER JOIN Invoice_Item ON Invoice.InvoiceNumber = Invoice_Item.InvoiceNumber
WHERE (((Invoice_Item.Item)="Dress Shirt"))
ORDER BY Customers.LastName ;

and then by first name in the descending order.
SELECT Customers.[First Name], Customers.LastName
FROM (Customers INNER JOIN Invoice ON Customers.CustomerNumber = Invoice.CustomerNumber) INNER JOIN Invoice_Item ON Invoice.InvoiceNumber = Invoice_Item.InvoiceNumber
WHERE (((Invoice_Item.Item)="Dress Shirt"))
ORDER BY Customers.[First Name] DESC ;

Use a join with a subquery to show the first name, last name, and total amount of all the customers who have had an order with an item named "Dress Shirt". Present the results first sorted by last name in the ascending order.
SELECT Customers.[First Name], Customers.LastName, Invoice.TotalAmount
FROM (Customers INNER JOIN Invoice ON Customers.CustomerNumber = Invoice.CustomerNumber) INNER JOIN Invoice_Item ON Invoice.InvoiceNumber = Invoice_Item.InvoiceNumber
WHERE (((Invoice_Item.Item)="Dress Shirt"))
ORDER BY Customers.LastName ;

and then by first name in the descending order.
SELECT Customers.[First Name], Customers.LastName, Invoice.TotalAmount
FROM (Customers INNER JOIN Invoice ON Customers.CustomerNumber = Invoice.CustomerNumber) INNER JOIN Invoice_Item ON Invoice.InvoiceNumber = Invoice_Item.InvoiceNumber
WHERE (((Invoice_Item.Item)="Dress Shirt"))
ORDER BY Customers.[First Name] DESC;

Calculate the average total amount.
SELECT AVG(TotalAmount) AS AverageAmount
FROM Invoice;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote