You need to create a stored procedure that enters values into multiple tables. The solution must ensure that if a single insert fails, none of the values are inserted into the tables.
How should you complete the stored procedure? To answer, drag the appropriate values to the correct locations. Each value may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
You use a Microsoft Azure SQL Database instance named ContosoDb. ContosoDb contains a table named Products that has existing records.
The Products table has columns named Code and QuantityOnHand.
You need to create a new column in the Products table named Category that allows null values and sets the value of the Category column to General for all existing records.
Which three Transact-SQL segments should you use to develop the solution? To answer, move the appropriate Transact-SQL segments from the list of Transact-SQL segments to the answer area and arrange them in the correct order.
Select and Place:
Answer is in the explanation below.
Reference / correct answer:
NULL or NOT NULL specifies whether the column can accept null values. Columns that do not allow null values can be added with ALTER TABLE only if they have a default specified or if the table is empty. NOT NULL can be specified for computed columns only if PERSISTED is also specified. If the new column allows null values and no default is specified, the new column contains a null value for each row in the table. If the new column allows null values and a default definition is added with the new column, WITH VALUES can be used to store the default value in the new column for each existing row in the table.
You are developing an SQL Server database. The database contains two tables and a function that are defined by the following Transact-SQL statements.
You need to create a query to determine the total number of products that are sold each day for the five top-selling products on that particular day.
How should you complete the Transact-SQL script? To answer, select the appropriate Transact-SQL statements in the answer area.
Hot Area:
Answer is in the explanation below.
Reference / correct answer:
The APPLY operator allows you to invoke a table-valued function for each row returned by an outer table expression of a query. T
There are two forms of APPLY: CROSS APPLY and OUTER APPLY. CROSS APPLYreturns only rows from the outer table that produce a result set from the table-valued function. OUTER APPLY returns both rows that produce a result set, and rows that do not, with NULL values in the columns produced by the table-valued function.