How should you complete the Transact-SQL statement?

DRAG DROP
You have a database that contains the following tables:

A delivery person enters an incorrect value for the CustomerID column in the Invoices table and enters the
following text in the ConfirmedReceivedBy column: “Package signed for by the owner Tim.”
You need to find the records in the Invoices table that contain the word Tim in the CustomerName field.
How should you complete the Transact-SQL statement? To answer, drag the appropriate Transact-SQL
segments to the correct locations. Each Transact-SQL segment 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.
NOTE: Each correct selection is worth one point.
Select and Place:

DRAG DROP
You have a database that contains the following tables:

A delivery person enters an incorrect value for the CustomerID column in the Invoices table and enters the
following text in the ConfirmedReceivedBy column: “Package signed for by the owner Tim.”
You need to find the records in the Invoices table that contain the word Tim in the CustomerName field.
How should you complete the Transact-SQL statement? To answer, drag the appropriate Transact-SQL
segments to the correct locations. Each Transact-SQL segment 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.
NOTE: Each correct selection is worth one point.
Select and Place:

Answer:

Explanation:
Box 1:SELECT CustomerID FROM Sales.Invoices
Box 2:INNER JOIN Sales.Customers.CustomerID = Sales.Invoices.CustomerID
Box 3:WHERE CustomerName LIKE ‘%tim%’
Box 4:WHERE ConfirmedReceiveBy IN (SELECT CustomerName FROM Sales.Customers)



Leave a Reply 4

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


scotrideff

scotrideff

select Invoices.customerID
from Invoices

Inner join customers
on customers.customerID = Invoices.customerID

where CustomerName like ‘%tim%’
go

E Rod

E Rod

Select CustomerId From Sales.Customers
Where CustomerName Like ‘%tim%’
UNION
Select CustomerId From Sales.Invoces
Where ConfirmedReceivedBy Like ‘%tim%’

EY Auditor

EY Auditor

agree with this E Rod.

Why the original answer has fucking three where clauses together.

steven

steven

Select CustomerId From Sales.Customers
Where CustomerName Like ‘%tim%’
UNION ALL
Select CustomerId From Sales.Invoces
Where ConfirmedReceivedBy Like ‘%tim%’