070-461J Free Dumps Study Materials
Question 19: 会社のすべての販売データを含むSQL Serverデータベースがあります。
実際の総売上の上位5パーセントを表す顧客を返すクエリを作成する必要があります。
正しいTransact-
SQLの一部は、以下の回答エリアで提供されています。問題を解決し、記載されている目標
または要件を満たすコードを回答領域に入力します。提供されているコード内およびその下
にコードを追加できます。
[構文の確認]ボタンを使用して、作業を確認します。構文またはスペルのエラーは、行と文
字の位置ごとに報告されます。
A. 1 SELECT CustomerID, N
2 ,Top5= TOP (0,95) PERCENT Sales (ORDER BY N) OVER (PARTITION BY Sales)
3 FROM Customers;
Add TOP and PERCENT Sales on line 2.
Syntax:
TOP (expression) [PERCENT]
[ WITH TIES ]
]
expression
Is the numeric expression that specifies the number of rows to be returned. expression is
implicitly converted to a float value if PERCENT is specified; otherwise, it is converted to
bigint.
PERCENT
Indicates that the query returns only the first expression percent of rows from the result set.
Fractional values are rounded up to the next integer value.
B. 1 SELECT CustomerID, N
2 ,Top5= TOP (0,95) PERCENT Sales (ORDER BY N) OVER (PARTITION BY Sales)
3 FROM Customers;
Add TOP and PERCENT Sales on line 2.
Is the numeric expression that specifies the number of rows to be returned. expression is
implicitly converted to a float value if PERCENT is specified; otherwise, it is converted to
bigint.
PERCENT
Indicates that the query returns only the first expression percent of rows from the result set.
Fractional values are rounded up to the next integer value.
Correct Answer: A
Explanation:
References: https://docs.microsoft.com/en-us/sql/t-sql/queries/top-transact-sql?view=sql-
server-2017