oracle 1z0-071 practice test

Oracle Database SQL

Last exam update: Dec 11 ,2025
Page 1 out of 22. Viewing questions 1-15 out of 326

Question 1

Choose the best answer.
Examine the description of the EMPLOYEES table:

Which query is valid?

  • A. SELECT dept_id, join_date,SUM(salary) FROM employees GROUP BY dept_id, join_date;
  • B. SELECT depe_id,join_date,SUM(salary) FROM employees GROUP BY dept_id:
  • C. SELECT dept_id,MAX(AVG(salary)) FROM employees GROUP BY dept_id;
  • D. SELECT dept_id,AVG(MAX(salary)) FROM employees GROUP BY dapt_id;
Mark Question:
Answer:

A


Explanation:
In Oracle 12c SQL, the GROUP BY clause is used to arrange identical data into groups with the GROUP
BY expression followed by the SELECT statement. The SUM() function is then used to calculate the
sum for each grouped record on a specific column, which in this case is the salary column.
Option A is valid because it correctly applies the GROUP BY clause. Both dept_id and join_date are
included in the SELECT statement, which is a requirement when using these columns in conjunction
with the GROUP BY clause. This means that the query will calculate the sum of salaries for each
combination of dept_id and join_date. It adheres to the SQL rule that every item in the SELECT list
must be either an aggregate function or appear in the GROUP BY clause.
Option B is invalid due to a typo in SELECT depe_id and also because it ends with a colon rather than
a semicolon.
Option C is invalid because you cannot nest aggregate functions like MAX(AVG(salary)) without a
subquery.
Option D is invalid for the same reason as option C, where it tries to nest aggregate functions
AVG(MAX(salary)), which is not allowed directly in SQL without a subquery.
For further reference, you can consult the Oracle 12c documentation, which provides comprehensive
guidelines on how to use the GROUP BY clause and aggregate functions like SUM():
Oracle Database SQL Language Reference, 12c Release 1 (12.1): GROUP BY Clause
Oracle Database SQL Language Reference, 12c Release 1 (12.1): Aggregate Functions

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 2

Which three are true about the CREATE TABLE command?

  • A. It can include the CREATE...INDEX statement for creating an index to enforce the primary key constraint.
  • B. The owner of the table should have space quota available on the tablespace where the table is defined.
  • C. It implicitly executes a commit.
  • D. It implicitly rolls back any pending transactions.
  • E. A user must have the CREATE ANY TABLE privilege to create tables.
  • F. The owner of the table must have the UNLIMITED TABLESPACE system privilege.
Mark Question:
Answer:

B, C, E


Explanation:
A . False - The CREATE TABLE command cannot include a CREATE INDEX statement within it. Indexes
to enforce constraints like primary keys are generally created automatically when the constraint is
defined, or they must be created separately using the CREATE INDEX command.
B . True - The owner of the table needs to have enough space quota on the tablespace where the
table is going to be created, unless they have the UNLIMITED TABLESPACE privilege. This ensures
that the database can allocate the necessary space for the table. Reference: Oracle Database SQL
Language Reference, 12c Release 1 (12.1).
C . True - The CREATE TABLE command implicitly commits the current transaction before it executes.
This behavior ensures that table creation does not interfere with transactional consistency.
Reference: Oracle Database SQL Language Reference, 12c Release 1 (12.1).
D . False - It does not implicitly roll back any pending transactions; rather, it commits them.
E . True - A user must have the CREATE ANY TABLE privilege to create tables in any schema other than
their own. To create tables in their own schema, they need the CREATE TABLE privilege. Reference:
Oracle Database Security Guide, 12c Release 1 (12.1).
F . False - While the UNLIMITED TABLESPACE privilege allows storing data without quota restrictions
on any tablespace, it is not a mandatory requirement for a table owner. Owners can create tables as
long as they have sufficient quotas on the specific tablespaces.

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
F
50%
Discussions
vote your answer:
A
B
C
D
E
F
0 / 1000

Question 3

The CUSTOMERS table has a CUST_CREDT_LIMIT column of data type number.
Which two queries execute successfully?

  • A. SELECT TO_CHAR(NVL(cust_credit_limit * .15,'Not Available')) FROM customers;
  • B. SELECT NVL2(cust_credit_limit * .15,'Not Available') FROM customers;
  • C. SELECT NVL(cust_credit_limit * .15,'Not Available') FROM customers;
  • D. SLECT NVL(TO_CHAR(cust_credit_limit * .15),'Not available') from customers;
  • E. SELECT NVL2(cust_credit_limit,TO_CHAR(cust_credit_limit * .15),'NOT Available') FROM customers;
Mark Question:
Answer:

A, E


Explanation:
A . True - The TO_CHAR function is used correctly here to convert the numeric value to a string, and
NVL handles the case where cust_credit_limit might be NULL. The expression inside NVL computes
15% of the credit limit or displays 'Not Available' if the credit limit is NULL. The syntax is correct.
B . False - The NVL2 function requires three parameters: the expression to check for NULL, the value
to return if it's not NULL, and the value to return if it is NULL. The given usage lacks the required
parameters and syntax.
C . False - The NVL function expects both parameters to be of the same data type. Since the second
parameter 'Not Available' is a string, it causes a data type conflict with the numerical result of the
first parameter.
D . False - The keyword SELECT is misspelled as SLECT, making the syntax incorrect.
E. True - This query uses NVL2 correctly by checking if cust_credit_limit is not NULL, then applying
TO_CHAR to compute 15% of it and converting it to string, or returning 'NOT Available' if it is NULL.
The syntax and function usage are correct.

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 4

Choose two
Examine the description of the PRODUCT DETALS table:

  • A. PRODUCT_ID can be assigned the PEIMARY KEY constraint.
  • B. EXPIRY_DATE cannot be used in arithmetic expressions.
  • C. EXPIRY_DATE contains the SYSDATE by default if no date is assigned to it
  • D. PRODUCT_PRICE can be used in an arithmetic expression even if it has no value stored in it
  • E. PRODUCT_PRICE contains the value zero by default if no value is assigned to it.
  • F. PRODUCT_NAME cannot contain duplicate values.
Mark Question:
Answer:

A, D


Explanation:
A . PRODUCT_ID can be assigned the PRIMARY KEY constraint.
In Oracle Database 12c, a PRIMARY KEY constraint is a combination of a NOT NULL constraint and a
unique constraint. It ensures that the data contained in a column, or a group of columns, is unique
among all the rows in the table and not null. Given the PRODUCT_ID is marked as NOT NULL, it is a
candidate for being a primary key because we can assume that it is intended to uniquely identify
each product in the table.
Reference: Oracle 12c documentation states that a column defined with the NOT NULL constraint can
be used as a primary key, provided the values in the column are also unique (Oracle Database SQL
Language Reference, 12c Release 1 (12.1)).
B . EXPIRY_DATE cannot be used in arithmetic expressions. (Incorrect)
This statement is not necessarily true. Dates in Oracle can be used in arithmetic expressions, typically
to add or subtract days from a date.
C . EXPIRY_DATE contains the SYSDATE by default if no date is assigned to it. (Incorrect)
Unless explicitly specified, a date column does not default to SYSDATE. A default value must be set
using the DEFAULT clause during the table creation or altered later.
D . PRODUCT_PRICE can be used in an arithmetic expression even if it has no value stored in it.
This is correct. In Oracle, if a numeric column like PRODUCT_PRICE has a NULL value (meaning no
value stored in it), it can still be used in an arithmetic expression. In such expressions, NULL is
typically treated as a zero, but the result of any arithmetic with NULL is also NULL.
Reference: Oracle 12c SQL Language Reference indicates that if you include a numeric column with
NULL in an arithmetic expression, the outcome will be NULL, meaning that the operation considers
the NULL but does not necessarily treat it as zero (Oracle Database SQL Language Reference, 12c
Release 1 (12.1)).
E . PRODUCT_PRICE contains the value zero by default if no value is assigned to it. (Incorrect)
Unless a default value is explicitly specified during the table creation or altered later, a numeric
column like PRODUCT_PRICE does not automatically have a default value of zero.
F . PRODUCT_NAME cannot contain duplicate values. (Incorrect)
There is no constraint indicated that would prevent PRODUCT_NAME from containing duplicate
values. Without a UNIQUE or PRIMARY KEY constraint, a column can contain duplicates.
The correct answers are A and D. PRODUCT_ID can be the primary key because it's specified as NOT
NULL, thus it can uniquely identify each row in the table. PRODUCT_PRICE can be used in an
arithmetic expression with the understanding that if it's NULL, the result of the expression would be
NULL as well.

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
F
50%
Discussions
vote your answer:
A
B
C
D
E
F
0 / 1000

Question 5

The CUSTOMERS table has a CUST_LAST_NAME column of data type VARCHAR2.
The table has two rows whose COST_LAST_MANE values are Anderson and Ausson.
Which query produces output for CUST_LAST_SAME containing Oder for the first row and Aus for the
second?

  • A. SELECT REPLACE (REPLACE(cust_last_name,'son',''),'An','O') FROM customers;
  • B. SELECT REPLACE (TRIM(TRALING'son' FROM cust_last_name),'An','O') FROM customers;
  • C. SELECT INITCAP (REPLACE(TRIM('son' FROM cust_last_name),'An','O')) FROM customers;
  • D. SELECT REPLACE (SUBSTR(cust_last_name,-3),'An','O') FROM customers;
Mark Question:
Answer:

A


Explanation:
The REPLACE function in Oracle SQL is used to replace occurrences of a specified substring with
another substring. In this query, the inner REPLACE function call REPLACE(cust_last_name, 'son', '')
removes the substring 'son' from cust_last_name. The outer REPLACE function call then replaces the
substring 'An' with 'O'. For the given data, 'Anderson' would first be transformed to 'Ander' by the
inner REPLACE, and then 'Ander' would be transformed to 'Oder' by the outer REPLACE. Similarly,
'Ausson' would first change to 'Aus' by the inner REPLACE, which is unaffected by the outer REPLACE.
Reference can be found in the Oracle Database SQL Language Reference documentation, which
details the functionality of string functions, including REPLACE.

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 6

Which three statements are true about indexes and their administration in an Oracle database?

  • A. An INVISIBLE index is not maintained when Data Manipulation Language (DML) is performed on its underlying table.
  • B. An index can be created as part of a CREATE TABLE statement.
  • C. A DROP INDEX statement always prevents updates to the table during the drop operation
  • D. A UNIQUE and non-unique index can be created on the same table column
  • E. A descending index is a type of function-based index
  • F. If a query filters on an indexed column then it will always be used during execution of the query
Mark Question:
Answer:

B, D, E


Explanation:
A . This statement is incorrect. An INVISIBLE index is maintained during DML operations just like a
VISIBLE index. The difference is that an INVISIBLE index is not used by the optimizer unless explicitly
hinted. B. This statement is correct. When creating a table, you can define indexes on one or more
columns as part of the table definition. C. This statement is incorrect. While a DROP INDEX statement
will drop the index, it does not always prevent updates to the table. If the index is marked as
unusable or is an invisible index, for example, updates can still be performed. D. This statement is
correct. It is possible to have both a UNIQUE index and a non-unique index on the same column. The
UNIQUE index enforces the uniqueness of column values, while the non-unique index does not. E.
This statement is correct to some extent. Descending indexes are not function-based indexes per se,
but they are indexes on which the data is sorted in descending order, as opposed to the default
ascending order. However, descending indexes are conceptually related to function-based indexes
because they alter the way the indexed data is stored. F. This statement is incorrect. The use of an
index in query execution depends on the optimizer's decision, which is based on statistics and the
cost associated with using the index. There are situations where the optimizer may choose a full
table scan even if there is an index on the filter column.
Reference can be found in the Oracle Database Concepts Guide and the SQL Language Reference
documentation, which detail the behavior of indexes and how they are managed within the Oracle
database.

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
F
50%
Discussions
vote your answer:
A
B
C
D
E
F
0 / 1000

Question 7

Which three are true about granting object privileges on tables, views, and sequences?

  • A. UPDATE can be granted only on tables and views.
  • B. DELETE can be granted on tables, views, and sequences.
  • C. REFERENCES can be granted only on tables and views.
  • D. INSERT can be granted on tables, views, and sequences.
  • E. SELECT can be granted only on tables and views.
  • F. ALTER can be granted only on tables and sequences.
Mark Question:
Answer:

C, E F


Explanation:
In Oracle Database, object privileges are rights to perform a particular action on a specific object in
the database. Here's why the other options are incorrect:
A . UPDATE can be granted on tables, views, and materialized views, but not sequences. B. DELETE
cannot be granted on sequences because sequences do not store data that can be deleted. D. INSERT
cannot be granted on sequences; sequences are used to generate numbers, not to be inserted into
directly. C. REFERENCES allows the grantee to create a foreign key that references the table or the
columns of the table. It is applicable only to tables and views. E. SELECT can indeed only be granted
on tables and views (including materialized views). F. ALTER is an object privilege that can be granted
on tables and sequences but not views.
For more details, one may refer to the Oracle Database SQL Language Reference documentation,
which specifies the types of object privileges and the objects they apply to.

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
F
50%
Discussions
vote your answer:
A
B
C
D
E
F
0 / 1000

Question 8

The EMPLOYEES table contains columns EMP_ID of data type NUMBER and HIRE_DATE of data type
DATE
You want to display the date of the first Monday after the completion of six months since hiring.
The NLS_TERRITORY parameter is set to AMERICA in the session and, therefore, Sunday is the first
day of the week Which query can be used?

  • A. SELECT emp_id,NEXT_DAY(ADD_MONTHS(hite_date,6),'MONDAY') FROM employees;
  • B. SELECT emp_id,ADD_MONTHS(hire_date,6), NEXT_DAY('MONDAY') FROM employees;
  • C. SELECT emp_id,NEXT_DAY(MONTHS_BETWEEN(hire_date,SYSDATE),6) FROM employees;
  • D. SELECT emp_id,NEXT_DAY(ADD_MONTHS(hire_date,6),1) FROM employees;
Mark Question:
Answer:

A


Explanation:
The function ADD_MONTHS(hire_date, 6) adds 6 months to the hire_date. The function
NEXT_DAY(date, 'day_name') finds the date of the first specified day_name after the date given. In
this case, 'MONDAY' is used to find the date of the first Monday after the hire_date plus 6 months.
Option A is correct as it accurately composes both ADD_MONTHS and NEXT_DAY functions to fulfill
the requirement.
Options B, C, and D do not provide a valid use of the NEXT_DAY function, either because of incorrect
syntax or incorrect logic in calculating the required date.
The Oracle Database SQL Language Reference for 12c specifies how these date functions should be
used.

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 9

Which three statements are true about views in an Oracle database?

  • A. A SELECT statement cannot contain a where clause when querying a view containing a WHERE clause in its defining query
  • B. Rows inserted into a table using a view are retained in the table if the view is dropped
  • C. Views can join tables only if they belong to the same schema.
  • D. Views have no segment.
  • E. Views have no object number.
  • F. A view can be created that refers to a non-existent table in its defining query.
Mark Question:
Answer:

B, D, F


Explanation:
A view is a virtual table based on a SQL query.
A . This is incorrect because a SELECT statement querying a view can contain a WHERE clause,
regardless of the view’s defining query. C. This is incorrect because views can join tables from
different schemas, not just the same schema. B. Correct. The rows inserted into a base table via a
view remain in the table even if the view is dropped because the view is just a window to the data in
the base tables. D. Correct. Views do not require storage space other than for the definition of the
view in the data dictionary, hence they have no segment. E. Incorrect. Views do not have object
numbers because they are not database objects that occupy physical space. F. Correct. You can create
a view that references non-existent tables; such a view would be considered invalid until the base
table is created.
The Oracle Database Concepts guide provides information about views and their characteristics.

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
F
50%
Discussions
vote your answer:
A
B
C
D
E
F
0 / 1000

Question 10

Which two statements are true about Oracle synonyms?

  • A. A synonym can have a synonym.
  • B. All private synonym names must be unique in the database.
  • C. Any user can create a PUBLIC synonym.
  • D. A synonym can be created on an object in a package.
  • E. A synonym has an object number.
Mark Question:
Answer:

A, C


Explanation:
Synonyms in Oracle Database are aliases for database objects.
A . Correct. A synonym can be created for another synonym, essentially chaining synonyms. B.
Incorrect. Private synonyms must be unique within a schema. However, because each user has their
own schema, multiple users can have private synonyms with the same name, each pointing to
objects in their respective schemas. C. Correct. Any user with the necessary privileges can create a
PUBLIC synonym, which is accessible to all users. D. Incorrect. A synonym cannot be created for an
object within a package, but it can be created for the package itself. E. Incorrect. Synonyms, like
views, do not have object numbers because they do not occupy space in the database as tables do.
Reference can be found in the Oracle Database SQL Language Reference documentation, which
details the rules and functionality of synonyms.

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 11

Which two statements are true about a self join?

  • A. The join key column must have an index.
  • B. It can be a left outer join.
  • C. It must be a full outer join.
  • D. It can be an inner join.
  • E. It must be an equijoin.
Mark Question:
Answer:

B, D


Explanation:
A self join is a regular join, but the table is joined with itself. This kind of join can take the form of an
inner join, a left outer join, or even a full outer join depending on the requirement.
A . The join key column must have an index. (Incorrect)
While indexes can improve the performance of joins by reducing the cost of the lookup operations,
they are not a requirement for a self join. A self join can be performed with or without an index on
the join key columns.
B . It can be a left outer join. (Correct)
A self join can indeed be a left outer join. This is useful when you want to include all records from the
'left' side of the join (the table itself), even if the join condition does not find any matching record on
the 'right' side (the table itself again).
Reference: Oracle Database SQL Language Reference, which explains the use of joins, including self
joins (Oracle Database SQL Language Reference, 12c Release 1 (12.1)).
C . It must be a full outer join. (Incorrect)
A self join does not need to be a full outer join; it can be any type of join depending on what the
query needs to accomplish.
D . It can be an inner join. (Correct)
Just like with any two different tables, a self join can be an inner join. This would return only the rows
with matching values in the self join condition.
E . It must be an equijoin. (Incorrect)
Although self joins are often equijoins, meaning the join condition is based on equality, they do not
have to be. Self joins can use other operators such as <, >, <=, >=, !=, etc., depending on the
requirements of the query.

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 12

Which three statements are true about dropping and unused columns in an Oracle database?

  • A. A primary key column referenced by another column as a foreign key can be dropped if using the CASCADE option.
  • B. A DROP COLUMN command can be rolled back.
  • C. An UNUSED column's space is remained automatically when the block containing that column is next queried.
  • D. An UNUSED column's space is remained automatically when the row containing that column is next queried.
  • E. Partition key columns cannot be dropped.
  • F. A column that is set to NNUSED still counts towards the limit of 1000 columns per table.
Mark Question:
Answer:

B, E, F


Explanation:
A . A primary key column referenced by another column as a foreign key can be dropped if using the
CASCADE option. (Incorrect)
Primary key columns that are referenced by foreign keys cannot be dropped as it would violate
referential integrity. The CASCADE option does not apply in this context.
B . A DROP COLUMN command can be rolled back. (Correct)
Dropping a column from a table is a transactional operation. If it's not committed, it can be rolled
back.
Reference: Oracle Database SQL Language Reference confirms that the DROP COLUMN operation is
transactional and can be rolled back if it is not committed (Oracle Database SQL Language Reference,
12c Release 1 (12.1)).
C . An UNUSED column's space is remained automatically when the block containing that column is
next queried. (Incorrect)
The space occupied by an UNUSED column is not automatically reclaimed in this way.
D . An UNUSED column's space is remained automatically when the row containing that column is
next queried. (Incorrect)
Similar to C, the space for an UNUSED column is not reclaimed automatically upon querying the row.
E . Partition key columns cannot be dropped. (Correct)
Partition key columns are integral to the partitioning strategy of a table and cannot be dropped.
Reference: Oracle Database VLDB and Partitioning Guide details the restrictions on dropping partition
key columns (Oracle Database VLDB and Partitioning Guide, 12c Release 1 (12.1)).
F . A column that is set to UNUSED still counts towards the limit of 1000 columns per table. (Correct)
Marking a column as UNUSED is a logical operation that prevents it from being used in future DML
operations, but it still counts towards the column limit of the table until it is actually dropped from
the table.
Reference: Oracle Database SQL Language Reference indicates that UNUSED columns count toward
the column limit (Oracle Database SQL Language Reference, 12c Release 1 (12.1)).

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
F
50%
Discussions
vote your answer:
A
B
C
D
E
F
0 / 1000

Question 13

Examine this query:
SELECT TRUNC (ROUND(156.00,-2),-1) FROM DUAL; What is the result?

  • A. 16
  • B. 160
  • C. 150
  • D. 200
  • E. 100
Mark Question:
Answer:

D


Explanation:
The query uses two functions: ROUND and TRUNC. The ROUND function will round the number
156.00 to the nearest hundred because of the -2 which specifies the number of decimal places to
round to. This will result in 200. Then the TRUNC function truncates this number to the nearest 10,
due to the -1 argument, which will give us 200 as the result since truncation does not change the
rounded value in this case.
A . 16 (Incorrect)
B . 160 (Incorrect)
C . 150 (Incorrect)
D . 200 (Incorrect)
E . 100 (Incorrect)
Reference: Oracle Database SQL Language Reference specifies how ROUND and TRUNC functions
behave when applied to numbers (Oracle Database SQL Language Reference, 12c Release 1 (12.1)).
The query functions sequentially: ROUND(156.00,-2) rounds to the nearest hundred, resulting in 200.
Then TRUNC(200,-1) truncates to the nearest ten, which does not change the value, hence the final
result is 200.

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 14

Examine this SQL statement:

Which two are true?

  • A. The subquery is executed before the UPDATE statement is executed.
  • B. All existing rows in the ORDERS table are updated.
  • C. The subquery is executed for every updated row in the ORDERS table.
  • D. The UPDATE statement executes successfully even if the subquery selects multiple rows.
  • E. The subquery is not a correlated subquery.
Mark Question:
Answer:

C, A


Explanation:
The provided SQL statement is an update statement that involves a subquery which is correlated to
the main query.
A . The subquery is executed before the UPDATE statement is executed. (Incorrect)
This statement is not accurate in the context of correlated subqueries. A correlated subquery is one
where the subquery depends on values from the outer query. In this case, the subquery is executed
once for each row that is potentially updated by the outer UPDATE statement because it references a
column from the outer query (o.customer_id).
B . All existing rows in the ORDERS table are updated. (Incorrect)
Without a WHERE clause in the outer UPDATE statement, this would typically be true. However, the
correctness of this statement depends on the actual data and presence of matching customer_id
values in both tables. If there are rows in the ORDERS table with customer_id values that do not exist
in the CUSTOMERS table, those rows will not be updated.
C . The subquery is executed for every updated row in the ORDERS table. (Correct)
Because the subquery is correlated (references o.customer_id from the outer query), it must be
executed for each row to be updated in the ORDERS table to get the corresponding cust_last_name
from the CUSTOMERS table.
Reference: The behavior of correlated subqueries is detailed in the Oracle Database SQL Language
Reference, which explains that a correlated subquery is evaluated once for each row processed by
the parent statement (Oracle Database SQL Language Reference, 12c Release 1 (12.1)).
D . The UPDATE statement executes successfully even if the subquery selects multiple rows.
(Incorrect)
The subquery inside the SET clause must return exactly one value for each row to be updated. If the
subquery returns more than one row for any outer row, the UPDATE statement will result in an error
(specifically, an "ORA-01427: single-row subquery returns more than one row" error).
E . The subquery is not a correlated subquery. (Incorrect)
This is incorrect because the subquery references the o.customer_id column from the ORDERS table,
which makes it a correlated subquery.
The correct answers are A and C. The subquery is a correlated subquery because it references the
ORDERS table's customer_id in its WHERE clause. It is executed for each row to be updated since it
depends on values from the outer query (the o.customer_id). It's important to note that although the
statement A is marked incorrect based on the typical behavior of correlated subqueries, in some
cases, Oracle's optimizer may unnest the subquery and execute it beforehand if it determines that
it's more efficient and the result is the same. However, this doesn't change the nature of the query
being a correlated subquery.

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 15

Examine the description of the PRODUCTS table:

Which three queries use valid expressions?

  • A. SELECT produet_id, unit_pricer, 5 "Discount",unit_price+surcharge-discount FROM products;
  • B. SELECT product_id, (unit_price * 0.15 / (4.75 + 552.25)) FROM products;
  • C. SELECT ptoduct_id, (expiry_date-delivery_date) * 2 FROM products;
  • D. SPLECT product_id, expiry_date * 2 FROM products;
  • E. SELEGT product_id, unit_price, unit_price + surcharge FROM products;
  • F. SELECT product_id,unit_price || "Discount", unit_price + surcharge-discount FROM products;
Mark Question:
Answer:

B, C, E


Explanation:
B . SELECT product_id, (unit_price * 0.15 / (4.75 + 552.25)) FROM products; C. SELECT product_id,
(expiry_date - delivery_date) * 2 FROM products; E. SELECT product_id, unit_price, unit_price +
surcharge FROM products;
Comprehensive and Detailed Explanation WITH all Reference:
A . This is invalid because "Discount" is a string literal and cannot be used without quotes in an
arithmetic operation. Also, there is a typo in unit_pricer, and 'discount' is not a defined column in the
table. B. This is valid. It shows a mathematical calculation with unit_price, which is of NUMBER type.
Division and multiplication are valid operations on numbers. C. This is valid. The difference between
two DATE values results in the number of days between them, and multiplying this value by a
number is a valid operation. D. This is invalid because expiry_date is of DATE type and cannot be
multiplied by a number. Also, there's a typo: "SPLECT" should be "SELECT". E. This is valid. Both
unit_price and surcharge are NUMBER types, and adding them together is a valid operation. F. This is
invalid because concatenation operator || is used between a number (unit_price) and a string literal
"Discount", which is not enclosed in single quotes, and 'discount' is not a defined column in the
table.
In SQL, arithmetic operations on numbers and date arithmetic are valid expressions. Concatenation is
also a valid expression when used correctly between string values or literals. Operations that involve
date types should not include multiplication or division by numbers directly without a proper interval
type in Oracle SQL.
These rules are detailed in the Oracle Database SQL Language Reference, where expressions,
datatype precedence, and operations are defined.

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
F
50%
Discussions
vote your answer:
A
B
C
D
E
F
0 / 1000
To page 2