Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions

Question

What will you do or say to Anthony about this issue?

Answered: 1 week ago