Question: reate a database containing the following two tables: Customer(CustomerNumber, CustomerLastName, CustomerFirstName, CustomerBalance,EmailAddress) Invoice(InvoiceNumber,CustomerNumber, InvoiceDate,InvoiceAmount) CustomerNumber is a surrogate key that starts at 2000 and increments
reate a database containing the following two tables:
Customer(CustomerNumber, CustomerLastName, CustomerFirstName, CustomerBalance,EmailAddress)
Invoice(InvoiceNumber,CustomerNumber, InvoiceDate,InvoiceAmount)
CustomerNumber is a surrogate key that starts at 2000 and increments by 1
InvoiceNumber is a surrogate key that starts at 7000 and increments by 1
The database has the following referential integrity constraints:
CustomerNumber in Invoice must exist in CustomerNumber in Customer table
The relationship between Customer and Invoice table is 1: N
The column characteristics for the wto tables are shown below
| Column Name | Type | Key | Required | Remarks |
| CustomerNumber | INT | Primary Key | Yes | Surrogate Key: Initia Value = 2000 Increment = 1 |
| CustomerLName | Varchar(20) | NO | Yes | |
| CustomerFName | Varchar(20) | No | Yes | |
| CustomerBalance | Number | No | Yes | |
| EmailAddress | Varchar(50) | No | No |
INVOICE
| Column Name | Type | Key | Required | Remarks |
| InvoiceNumber | INT | Primary Key | YEs | Surrogate Key: Initial Value= 7000 Increment = 1 |
| CustomerNumber | INT | Foreign Key | Yes | |
| InvoiceDate | Date | NO | Yes | |
| InvoiceAmount | Number | No | YEs |
the data are shown as below
CustomerNumber CustomerFirstName CustomerBalance
-----------------------------------------------------------------------------------------------
2000 Frank 204
2001 Holly 500
2002 Joseph 700
2003 Ralph 900
Question
Write and run an SQL CREATE TABLE statement to create the Customer Table.Use a SQL statement to confirm Customer table is created.
Write and run an SQL CREATE TABLE statement to create the Invoice table. Use a SQL statement to confirm Invoice Table is created.
Write and run a set of SQL INSERT statements to populate the Customer Table. Use a SQL statement to confirm that the table is populated.
Write and run a set of SQL INSERT statements to populate the Invoice table. Use a SQL statement to confirm that the table is populated.
write the query that will show the invoice number, the invoice amount, the average invoice amount, and the difference between the average invoice amount and the actual invoice amount.
Note: This is Database, Make sure that the answers are accurate. Make sure you are good and accurate at Database. I posted the question for the first time, nobody answers it. I need the answers quickly in an hour.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
