Answer:
The correct answer is
D. <em>The number of items in the column list doesn't match the number in the VALUES list.</em>
Explanation:
When performing an insert action, the number of values to be inserted into each columns Must match the number of the columns that have been mentioned.
Now let us look at the question as given:
<em>INSERT INTO InvoiceCopy (VendorID, InvoiceNumber, InvoiceTotal, PaymentTotal, CreditTotal, TermsID, InvoiceDate, InvoiceDueDate) VALUES (97, '456789', 8344.50, 0, 0, 1, '2016-08-01')</em>
From the insert statement above, we have declared the system to insert into 8 columns( <em>VendorID, InvoiceNumber, InvoiceTotal, PaymentTotal, CreditTotal, TermsID, InvoiceDate, InvoiceDueDate)</em> of the table <em>InvoiceCopy,</em> but the number of values to be inserted into each column respectiveley is 7. So the statement will try to insert value 97 into column <em>VendorID, Value 456789 </em>into <em>column InvoiceNumber, Value 8344.50 into InvoiceTotal, Value 0 </em>into <em>column PaymentTotal, Value 0, </em>into <em>Column CreditTotal, Value 1, </em>into <em>Column TermsID, Value '2016-08-01' </em>into <em>Column InvoiceDate, But </em><em>null</em><em> will be inserted </em>into <em>Column InvoiceDueDate, However, the </em><em>Question states that None of these columns Accept Null Values. </em>This means that we have to specify values for EVERY column we want to insert into. Because of this number mismatch, the computer will throw an error. This is what is Wrong with the statement.
An insert statement is used to add new values to a database. When performing an insert statement, there are 3 main information that needs to be defined:
- The name of the table that the new data is being inserted into
- The name of the columns that you want to insert the values into
- The actual values that you want to add to the columns mentioned in (2) above.
The basic syntax of an insert statement is as follows:
INSERT INTO table_name (column1_name, column2_name, ...)
VALUES (data_for_column1, data_for_column2, ...);