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

Create a table for invoices that have been paid. Name this table invoicespaid. T

ID: 3854013 • Letter: C

Question

Create a table for invoices that have been paid. Name this table invoicespaid. The table should have columns for the VendorName, InvoiceNumber, InvoiceDate, InvoiceTotal, AccountNo, InvoiceLineItemAmount, and InvoiceLineItemDescription. You can use this create table statement. CREATE TABLE [dbo].[invoicespaid]( [VendorName] [varchar](200) NOT NULL, [InvoiceNumber] [varchar](50) NOT NULL, [InvoiceDate] [smalldatetime] NOT NULL, [InvoiceTotal] [money] NOT NULL, [AccountNo] [int] NOT NULL, [InvoiceLineItemAmount] [money] NOT NULL, [InvoiceLineItemDescription] [varchar](300) NOT NULL)

Insert into the invoicespaid table all of the records from the invoices and invoicelineitems tables that have been paid. Make sure this is an insert into statement that is using a select statement to get the records from the invoices and invoicelineitems tables.

Now, you want to mark those records that have been moved to this table. Add a column named moved to the invoices table using an alter table statement.

Write an update statement to update the records that were moved to true. All other records should be false.

1 create table statement, 1 insert statement, 1 alter table statement, 1 update statement

(Make sure your insert statement uses a select statement to pull values from the invoices and invoicelineitems table)

Need the full code written out please!

Explanation / Answer

Write SELECT INTO statements to create two test tables named VendorCopy and InvoiceCopy that are complete copies of the Vendors and Invoices tables. If VendorCopy and InvoiceCopy already exist, first code two DROP TABLE statements to delete them.

DROP TABLE InvoiceCopy;
DROP TABLE VendorCopy;

SELECT *
INTO InvoiceCopy
FROM Invoices

SELECT *
INTO VendorCopy
FROM Vendors

Write an INSERT statement that adds a row to the InvoiceCopy table with the following values:

VendorID:32

InvoiceTotal:$434.58

TermsID:2

InvoiceNumber:AX-014-027

PaymentTotal:$0.00

InvoiceDueDate:07/8/12

InvoiceDate:06/21/12

CreditTotal:$0.00

PaymentDate:null

INSERT InvoiceCopy
VALUES (32, 'AX-014-027', '2012-6- 21', 434.58, 0, 0,
2, '2012-07-08', NULL);

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