PrepAway - Latest Free Exam Questions & Answers

You need to create a query that returns a list of produ…

You have a database named Sales that contains the tables as shown in the exhibit. (Click the Exhibit button.)

You need to create a query that returns a list of products from Sales.ProductCatalog. The solution must meet the following requirements:
UnitPrice must be returned in descending order.
The query must use two-part names to reference the table.
The query must use the RANK function to calculate the results.
The query must return the ranking of rows in a column named PriceRank.
The list must display the columns in the order that they are defined in the table. PriceRank must appear last.
Part of the correct T-SQL statement has been provided in the answer area. Provide the complete code.

PrepAway - Latest Free Exam Questions & Answers

Answer: See the explanation

Explanation:
SELECT ProductCatalog.CatID, ProductCatalog.CatName, ProductCatalog.ProductID, ProductCatalog.ProdName, ProductCatalog.UnitPrice, RANK()
OVER (ORDER BY ProductCatalog.UnitPrice DESC) AS PriceRank FROM Sales.ProductCatalog ORDER BY ProductCatalog.UnitPrice DESC

3 Comments on “You need to create a query that returns a list of produ…

  1. Eugenia says:

    (2017/Sep/12)New 70-761 Exam Questions and Answers Free Updated Today! Following are some new 70-761 Questions i got:

    QUESTION
    Note: This question is part of a series of questions that use the same scenario. For your convenience, the scenario is repeated in each question. Each question presents a different goal and answer choices, but the text of the scenario is exactly the same in each question on this series.
    You have a database that tracks orders and deliveries for customers in North America. System versioning is enabled for all tables. The database contains the Sales.Customers, Application. Cities, and Sales.
    CustomerCategories tables.
    Details for the Sales.Customers table are shown in the following table:
    Details for the Application.Cities table are shown in the following table:
    Details for the Sales.CustomerCategories table are shown in the following table:
    You discover an application bug that impacts customer data for records created on or after January 1, 2014. In order to fix the data impacted by the bug, application programmers require a report that contains customer data as it existed on December 31 , 2013.
    You need to provide the query for the report.
    Which Transact-SQL statement should you use?

    A. Option A
    B. Option B
    C. Option C
    D. Option D

    Answer: D

    QUESTION
    Note: This question is part of a series of questions that use the same or similar answer choices. An answer choice may be correct for more than one question in the series. Each question is independent of the other questions in this series. Information and details provided in a question apply only to that question.
    You have a table named Products that contains information about the products that your company sells. The table contains many columns that do not always contain values.
    You need to implement an ANSI standard method to convert the NULL values in the query output to the phrase “Not Applicable”.
    What should you implement?

    A. the COALESCE function
    B. a view
    C. a table-valued function
    D. the TRY PARSE function
    E. a stored procedure
    F. the ISNULL function
    G. a scalar function
    H. the TRY CONVERT function

    Answer: F

    QUESTION
    Note: This question is part of a series of questions that use the same or similar answer choices. An answer choice may be correct for more than one question in the series. Each question is independent of the other questions in this series. Information and details provided in a question apply only to that question.
    You have a database that is denormalized. Users make frequent changes to data in a primary table. You need to ensure that users cannot change the tables directly, and that changes made to the primary table also update any related tables.
    What should you implement?

    A. the COALESCE function
    B. a view
    C. a table-valued function
    D. the TRY PARSE function
    E. a stored procedure
    F. the ISNULL function
    G. a scalar function
    H. the TRY CONVERT function

    Answer: B

    QUESTION
    Note: This question is part of a series of questions that use the same or similar answer choices. An answer choice may be correct for more than one question in the series. Each question is independent of the other questions in this series. Information and details provided in a question apply only to that question.
    You have a database that stores sales and order information.
    Users must be able to extract information from the tables on an ad hoc basis. They must also be able to reference the extracted information as a single table.
    You need to implement a solution that allows users to retrieve the data required, based on variables defined at the time of the query.
    What should you implement?

    A. the COALESCE function
    B. a view
    C. a table-valued function
    D. the TRY PARSE function
    E. a stored procedure
    F. the ISNULL function
    G. a scalar function
    H. the TRY CONVERT function

    Answer: C

    QUESTION
    Note: This question is part of a series of questions that use the same or similar answer choices. An answer choice may be correct for more than one question in the series. Each question is independent of the other questions in this series. Information and details provided in a question apply only to that question.
    You have a table named AuditTrail that tracks modifications to data in other tables. The AuditTrail table is updated by many processes. Data input into AuditTrail may contain improperly formatted date time values. You implement a process that retrieves data from the various columns in AuditTrail, but sometimes the process throws an error when it is unable to convert the data into valid date time values.
    You need to convert the data into a valid date time value using the en-US format culture code. If the conversion fails, a null value must be returned in the column output. The conversion process must not throw an error.
    What should you implement?

    A. the COALESCE function
    B. a view
    C. a table-valued function
    D. the TRY PARSE function
    E. a stored procedure
    F. the ISNULL function
    G. a scalar function
    H. the TRY CONVERT function

    Answer: H

    More new 70-761 Exam Questions comes from: https://drive.google.com/drive/folders/0B75b5xYLjSSNZG9yTW9reVdkZG8?usp=sharing I collected all new questions i got here for free read!




    0



    0
  2. HKM says:

    Why is it “ORDER BY ProductCatalog.UnitPrice DESC” if part of the correct T-SQL statement which had been provided in the answer area has ORDER BY PriceRank? Was the provided T-SQL statement incorrect?




    5



    0

Leave a Reply