You have a database that contains the following tables

Posted by: Pdfprep Category: 70-761 Tags: , ,

SIMULATION

You have a database that contains the following tables.

You need to create a query that lists all complaints from the Complaints table, and the name of the person handling the complaints if a person is assigned. The ComplaintID must be displayed first, followed by the person name.

Construct the query using the following guidelines:

– Use two-part column names.

– Use one-part table names.

– Do not use aliases for column names or table names.

– Do not use Transact-SQL functions.

– Do not use implicit joins.

– Do not surround object names with square brackets.

Part of the correct Transact-SQL has been provided in the answer area below. Enter the code in the answer area that resolves the problem and meets the stated goals or requirements. You can add code within the code that has been provided as well as below it.

Use the Check Syntax button to verify your work. Any syntax or spelling errors will be reported by line and character position.

Answer: 1 SELECT Complaints.ComplaintID, Persons.Name

2 FROM Complaints

4 LEFT OUTER JOIN Contacts ON Complaints.ComplaintID = Contacts.ComplaintID

5 LEFT OUTER JOIN Persons ON Contacts.PersonID = Persons.PersonID

References: https://technet.microsoft.com/en-us/library/ms190014(v=sql.105).aspx

Leave a Reply

Your email address will not be published.