You need to create a table named OrderDetails on a new server

CORRECT TEXT
You need to create a table named OrderDetails on a new server. OrderDetails must meet the
following requirements:
Contain a new column named LineltemTotal that stores the product of ListPrice and Quantity for
each row.
The calculation for a line item total must not be run every time the table is queried.
The code must NOT use any object delimiters.
The solution must ensure that LineItemTotal is stored as the last column in the table.
Part of the correct T-SQL statement has been provided in the answer area. Provide the complete
code.

CORRECT TEXT
You need to create a table named OrderDetails on a new server. OrderDetails must meet the
following requirements:
Contain a new column named LineltemTotal that stores the product of ListPrice and Quantity for
each row.
The calculation for a line item total must not be run every time the table is queried.
The code must NOT use any object delimiters.
The solution must ensure that LineItemTotal is stored as the last column in the table.
Part of the correct T-SQL statement has been provided in the answer area. Provide the complete
code.

Answer: See the explanation

Explanation:
CREATE TABLE OrderDetails
(
ListPrice money NOT NULL,
Quantity int NOT NULL,
LineItemTotal AS (ListPrice * Quantity) PERSISTED
)



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Peter

Peter

create table OrderDetails
(
ListPrice money not null,
Quantity int not null,
LineItemTotal as (ListPrice * Quantity) persisted
)