70-761日本語 無料問題集「Microsoft Querying Data with Transact-SQL (70-761日本語版)」
次の表を含むデータベースがあります。 すべてのテーブルはProductionスキーマにあります。

飲料カテゴリのすべての商品の商品名のリストを返すクエリを作成する必要があります。
以下のガイドラインを使用してクエリを構築します。
* テーブルエイリアスとしてテーブル名の最初の文字を使用してください。
* 2部構成の列名を使用してください。
* オブジェクト名を角括弧で囲まないでください。
* 暗黙的な結合は使用しないでください。
* 変数を使わないでください。
* リテラル値を囲むには一重引用符を使用してください。
正しいTransact-SQLの一部は、以下の回答領域にあります。 問題を解決し、記載されている目標または要件を満たすコードを回答領域に入力します。 提供されているコード内およびその下にコードを追加できます。

あなたの仕事を確かめるためにCheck Syntaxボタンを使ってください。 構文エラーやスペルミスは、行と文字の位置によって報告されます。 構文は必要に応じて何度でも確認できます。

飲料カテゴリのすべての商品の商品名のリストを返すクエリを作成する必要があります。
以下のガイドラインを使用してクエリを構築します。
* テーブルエイリアスとしてテーブル名の最初の文字を使用してください。
* 2部構成の列名を使用してください。
* オブジェクト名を角括弧で囲まないでください。
* 暗黙的な結合は使用しないでください。
* 変数を使わないでください。
* リテラル値を囲むには一重引用符を使用してください。
正しいTransact-SQLの一部は、以下の回答領域にあります。 問題を解決し、記載されている目標または要件を満たすコードを回答領域に入力します。 提供されているコード内およびその下にコードを追加できます。

あなたの仕事を確かめるためにCheck Syntaxボタンを使ってください。 構文エラーやスペルミスは、行と文字の位置によって報告されます。 構文は必要に応じて何度でも確認できます。
正解:
Please see explanation
Explanation
1 SELECT p.productname
2 FROM Production.categories AS c
3 inner join production.products as p on c.categoryid=p.categoryid
4 WHERE c.categoryname = 'Beverages'
Note: On line 3 change * to =
Explanation
1 SELECT p.productname
2 FROM Production.categories AS c
3 inner join production.products as p on c.categoryid=p.categoryid
4 WHERE c.categoryname = 'Beverages'
Note: On line 3 change * to =
注:この質問は、同じシナリオを提示する一連の質問の一部です。 シリーズの各質問には、上記の目標を達成できる独自の解決策が含まれています。 いくつかの質問セットには1つ以上の正しい解決策があるかもしれないが、他の質問セットには正しい解決策がないかもしれない。
このセクションの質問に答えた後。 あなたはそれに戻ることはできません。 その結果、これらの質問はレビュー画面に表示されません。
北米の顧客の注文と配送を追跡するデータベースがあります。データベースには、次の表が含まれています:
Sales.Customers

Application.Cities

Sales.CustomerCategories

Your company is developing a new social application that connects customers to each other based on the distance between their delivery locations.
最寄りの顧客を返すクエリを作成する必要があります。
解決策:次のTransact-SQLステートメントを実行します。

変数@custIDは有効な顧客に設定されています。
解決策は目標を達成していますか?
このセクションの質問に答えた後。 あなたはそれに戻ることはできません。 その結果、これらの質問はレビュー画面に表示されません。
北米の顧客の注文と配送を追跡するデータベースがあります。データベースには、次の表が含まれています:
Sales.Customers

Application.Cities

Sales.CustomerCategories

Your company is developing a new social application that connects customers to each other based on the distance between their delivery locations.
最寄りの顧客を返すクエリを作成する必要があります。
解決策:次のTransact-SQLステートメントを実行します。

変数@custIDは有効な顧客に設定されています。
解決策は目標を達成していますか?
正解:A
解答を投票する
注:この質問は、同じシナリオを提示する一連の質問の一部です。 シリーズの各質問には、記載された目標を達成できる独自の解決策が含まれています。 いくつかの質問セットには1つ以上の正しい解決策があるかもしれないが、他の質問セットには正しい解決策がないかもしれない。
このセクションの質問に答えた後。 あなたはそれに戻ることができません。 その結果、これらの質問はレビュー画面に表示されません。
次のTransact-SQLステートメントを実行して、Productsという名前のテーブルを作成します:

次のストアドプロシージャがあります:

次の新しい要件を満たすストアドプロシージャを変更する必要があります:
- 製品レコードを1つの作業単位として挿入します。
- 製品がデータベースに挿入できなかった場合にエラー番号51000を返します。
- 製品レコード挿入操作が失敗した場合は、製品情報をデータベースに永続的に書き込まないでください。
解決策:次のTransact-SQLステートメントを実行します:

解決策は目標を達成していますか?
このセクションの質問に答えた後。 あなたはそれに戻ることができません。 その結果、これらの質問はレビュー画面に表示されません。
次のTransact-SQLステートメントを実行して、Productsという名前のテーブルを作成します:

次のストアドプロシージャがあります:

次の新しい要件を満たすストアドプロシージャを変更する必要があります:
- 製品レコードを1つの作業単位として挿入します。
- 製品がデータベースに挿入できなかった場合にエラー番号51000を返します。
- 製品レコード挿入操作が失敗した場合は、製品情報をデータベースに永続的に書き込まないでください。
解決策:次のTransact-SQLステートメントを実行します:

解決策は目標を達成していますか?
正解:A
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
注:この質問は、同じシナリオを提示する一連の質問の一部です。 シリーズの各質問には、上記の目標を達成できる独自の解決策が含まれています。 いくつかの質問セットには1つ以上の正しい解決策があるかもしれないが、他の質問セットには正しい解決策がないかもしれない。
このセクションの質問に答えた後。 あなたはそれに戻ることはできません。 その結果、これらの質問はレビュー画面に表示されません。
北米の顧客の注文と配送を追跡するデータベースがあります。データベースには、次の表が含まれています:
Sales.Customers

Application.Cities

Sales.CustomerCategories

Your company is developing a new social application that connects customers to each other based on the distance between their delivery locations.
最寄りの顧客を返すクエリを作成する必要があります。
解決策:次のTransact-SQLステートメントを実行します。

変数@custIDは有効な顧客に設定されています。
解決策は目標を達成していますか?
このセクションの質問に答えた後。 あなたはそれに戻ることはできません。 その結果、これらの質問はレビュー画面に表示されません。
北米の顧客の注文と配送を追跡するデータベースがあります。データベースには、次の表が含まれています:
Sales.Customers

Application.Cities

Sales.CustomerCategories

Your company is developing a new social application that connects customers to each other based on the distance between their delivery locations.
最寄りの顧客を返すクエリを作成する必要があります。
解決策:次のTransact-SQLステートメントを実行します。

変数@custIDは有効な顧客に設定されています。
解決策は目標を達成していますか?
正解:A
解答を投票する
あなたはオンライン小売店のデータベース管理者です。次のTransact-SQLステートメントを実行して、注文を追跡するためのテーブルを作成します。

WebアプリケーションのJSONデータソースとして使用されるクエリを開発しています。 Webアプリケーションには、次の形式のJSONが必要です。


WebアプリケーションのJSONデータソースとして使用されるクエリを開発しています。 Webアプリケーションには、次の形式のJSONが必要です。

正解:

Explanation


Box 1: Order.Date
In PATH mode, you can use the dot syntax - for example, 'Item.UnitPrice' - to format nested output.
Here's a sample query that uses PATH mode with the FOR JSON clause. The following example also uses the ROOT option to specify a named root element.

Box 2: JSON_VALUE(LineTotal)
JSON_VALUE extracts a scalar value from a JSON string.
Box 3: Order.Product
Box 4: FOR JSON PATH
When you use the FOR JSON clause, you can specify the structure of the JSON output explicitly, or let the structure of the SELECT statement determine the output.
To maintain full control over the format of the JSON output, use FOR JSON PATH. You can create wrapper objects and nest complex properties.
To format the JSON output automatically based on the structure of the SELECT statement, use FOR JSON AUTO.
Box 5: FOR JSON PATH, ROOT('ORDER)
Use the ROOT option to specify a named root element.
References:
https://docs.microsoft.com/en-us/sql/relational-databases/json/format-query-results-as-json-with-for-json-sql-serv
https://docs.microsoft.com/en-us/sql/t-sql/functions/json-value-transact-sql