Oracle Database Quiz Questions

Course Name:Oracle
Chapter Name:Chapter 7 - DQL (Data Query Language)
Lesson Content Link:JSON SELECT
Current Quiz Count:30
Progress
0%
Q1
True / False

In Oracle, the JSON_EXISTS function is used to check if a specified JSON path exists in a JSON document.

Q2
True / False

In Oracle, you can use the SELECT statement to query JSON data stored in a column.

Q3
True / False

The JSON_QUERY function in Oracle extracts an array or object from a JSON document and returns it as a VARCHAR2 value.

Q4
True / False

In Oracle, the JSON_VALUE function extracts a scalar value from a JSON document and returns it as a SQL data type.

Q5
True / False

The JSON_TABLE function in Oracle creates a relational view of JSON data, allowing it to be queried like a regular table.

Q6
True / False

In Oracle, the IS JSON condition can be used to check if a column contains valid JSON data.

Q7
True / False

The JSON_OBJECT function in Oracle creates a JSON object from the specified key-value pairs and returns it as a VARCHAR2 value.

Q8
True / False

In Oracle, you can use the JSON_TABLE function to generate multiple columns from a single JSON document.

Q9
True / False

In Oracle, the JSON_MERGEPATCH function is used to apply a JSON Patch to a JSON document, modifying its content.

Q10
True / False

The Oracle Certified Professional (OCP) exam includes knowledge on using JSON functions like JSON_QUERY, JSON_TABLE, and JSON_VALUE effectively, understanding their syntax, and optimizing their performance in SQL queries.

Q11
Single Choice

Which Oracle function is used to retrieve a value from a JSON document stored in a column?

Q12
Single Choice

In Oracle, what is the correct syntax to select a specific value from a JSON column named data where the key is name?

Q13
Single Choice

Which Oracle SQL function is used to check if a JSON path exists within a JSON document?

Q14
Single Choice

Consider the following Oracle SQL query:What does this query return?

SQL Code
SELECT JSON_VALUE(data, '$.address.city') AS city
FROM customers;
Q15
Single Choice

Which of the following Oracle SQL functions can be used to return an array of JSON elements from a JSON document?

Q16
Single Choice

Consider the following Oracle SQL query:What does this query return?

SQL Code
SELECT JSON_QUERY(data, '$.items') AS items_array
FROM orders;
Q17
Single Choice

Given the Oracle SQL query:What does this query accomplish?

SQL Code
SELECT JSON_TABLE(data, '$.items[*]'
 COLUMNS (
 item_name VARCHAR2(50) PATH '$.name',
 item_price NUMBER PATH '$.price'
 ))
FROM orders;
Q18
Single Choice

How does Oracle SQL handle errors when the JSON_VALUE function encounters a path that does not exist?

Q19
Single Choice

Which Oracle SQL function can be used to join JSON data with relational data by treating JSON data as a relational table?

Q20
Single Choice

Consider the following Oracle SQL query:What is the result of this query?

SQL Code
SELECT c.customer_id, j.product_name
FROM customers c,
 JSON_TABLE(c.orders, '$.order_list[*]'
 COLUMNS (
 product_name VARCHAR2(100) PATH '$.product'
 )) j
WHERE c.customer_status = 'ACTIVE';
Q21
Multiple Choice

Which SQL code snippet correctly uses JSON_TABLE to extract a JSON object from a column in Oracle?

SQL Code
SELECT id, jt.name
FROM orders,
 JSON_TABLE(order_details, '$.customer'
 COLUMNS (name VARCHAR2(100) PATH '$.name')) jt;

SELECT id, jt.name
FROM orders,
 JSON_TABLE(order_details, '$.customer'
 COLUMNS (name VARCHAR2(100) PATH '$.name')) jt
WHERE jt.name IS NOT NULL;

SELECT id, jt.name
FROM orders,
 JSON_TABLE(order_details, '$.customer'
 COLUMNS (name VARCHAR2(100) PATH '$.name')) jt
WHERE jt.name = 'John Doe';
Q22
Multiple Choice

Which SQL code snippet demonstrates how to use JSON_VALUE to extract a value from a JSON column in Oracle?

SQL Code
SELECT id, JSON_VALUE(order_details, '$.customer.name') AS customer_name
FROM orders;

SELECT id, JSON_VALUE(order_details, '$.customer.address.city') AS city
FROM orders;

SELECT id, JSON_VALUE(order_details, '$.order_total') AS order_total
FROM orders;
Q23
Multiple Choice

Which SQL code snippet uses JSON_EXISTS to check if a specific key exists in a JSON column in Oracle?

SQL Code
SELECT id
FROM orders
WHERE JSON_EXISTS(order_details, '$.customer.name');

SELECT id
FROM orders
WHERE JSON_EXISTS(order_details, '$.order_total');

SELECT id
FROM orders
WHERE JSON_EXISTS(order_details, '$.items[0]');
Q24
Multiple Choice

Which SQL code snippet demonstrates advanced use of JSON_TABLE to flatten a nested JSON array into a relational format in Oracle?

SQL Code
SELECT id, jt.product_name, jt.quantity
FROM orders,
 JSON_TABLE(order_details, '$.items[*]'
 COLUMNS (product_name VARCHAR2(50) PATH '$.product_name',
 quantity NUMBER PATH '$.quantity')) jt;

SELECT id, jt.product_name, jt.quantity
FROM orders,
 JSON_TABLE(order_details, '$.items[*]'
 COLUMNS (product_name VARCHAR2(50) PATH '$.product_name',
 quantity NUMBER PATH '$.quantity')) jt
WHERE jt.quantity > 1;

SELECT id, jt.product_name, jt.quantity
FROM orders,
 JSON_TABLE(order_details, '$.items[*]'
 COLUMNS (product_name VARCHAR2(50) PATH '$.product_name',
 quantity NUMBER PATH '$.quantity')) jt
ORDER BY jt.product_name;
Q25
Multiple Choice

Which SQL code snippet demonstrates how to use JSON_QUERY to return a JSON fragment from a column in Oracle?

SQL Code
SELECT id, JSON_QUERY(order_details, '$.customer') AS customer_info
FROM orders;

SELECT id, JSON_QUERY(order_details, '$.items[0]') AS first_item
FROM orders;

SELECT id, JSON_QUERY(order_details, '$.shipping') AS shipping_info
FROM orders;
Q26
Multiple Choice

Which SQL code snippet demonstrates advanced use of JSON_VALUE to extract nested values from a JSON column in Oracle?

SQL Code
SELECT id, JSON_VALUE(order_details, '$.customer.address.city') AS city
FROM orders;

SELECT id, JSON_VALUE(order_details, '$.items[0].product_name') AS first_product_name
FROM orders;

SELECT id, JSON_VALUE(order_details, '$.shipping.method') AS shipping_method
FROM orders;
Q27
Multiple Choice

Which SQL code snippet demonstrates certification-level use of JSON_TABLE to parse a complex JSON array in Oracle?

SQL Code
SELECT id, jt.product_name, jt.price
FROM orders,
 JSON_TABLE(order_details, '$.items[*]'
 COLUMNS (product_name VARCHAR2(50) PATH '$.product_name',
 price NUMBER PATH '$.price')) jt;

SELECT id, jt.product_name, jt.price
FROM orders,
 JSON_TABLE(order_details, '$.items[*]'
 COLUMNS (product_name VARCHAR2(50) PATH '$.product_name',
 price NUMBER PATH '$.price')) jt
WHERE jt.price > 20;

SELECT id, jt.product_name, jt.price
FROM orders,
 JSON_TABLE(order_details, '$.items[*]'
 COLUMNS (product_name VARCHAR2(50) PATH '$.product_name',
 price NUMBER PATH '$.price')) jt
ORDER BY jt.price DESC;
Q28
Multiple Choice

Which SQL code snippet demonstrates how to use JSON_EXISTS to filter records based on the existence of a specific key in a JSON array in Oracle?

SQL Code
SELECT id
FROM orders
WHERE JSON_EXISTS(order_details, '$.items[0].product_name');

SELECT id
FROM orders
WHERE JSON_EXISTS(order_details, '$.shipping.method');

SELECT id
FROM orders
WHERE JSON_EXISTS(order_details, '$.customer.name');
Q29
Multiple Choice

Which SQL code snippet demonstrates advanced use of JSON_QUERY to return a nested JSON object from a column in Oracle?

SQL Code
SELECT id, JSON_QUERY(order_details, '$.shipping') AS shipping_info
FROM orders;

SELECT id, JSON_QUERY(order_details, '$.customer') AS customer_info
FROM orders;

SELECT id, JSON_QUERY(order_details, '$.items') AS items_info
FROM orders;
Q30
Multiple Choice

Which SQL code snippet demonstrates certification-level use of JSON_VALUE to extract multiple values from a JSON column in Oracle?

SQL Code
SELECT id, JSON_VALUE(order_details, '$.customer.name') AS customer_name,
 JSON_VALUE(order_details, '$.shipping.method') AS shipping_method
FROM orders;

SELECT id, JSON_VALUE(order_details, '$.customer.name') AS customer_name,
 JSON_VALUE(order_details, '$.items[0].product_name') AS first_product_name
FROM orders;

SELECT id, JSON_VALUE(order_details, '$.customer.address.city') AS city,
 JSON_VALUE(order_details, '$.order_total') AS total_amount
FROM orders;