Database 23ai SQL Certified Associate Free Sample Questions

12 free sample questions135 in the full practice test

Try simulator

1Z0-171 Sample Questions

  1. Question 1

    Advanced

    Use DDL to manage tables and their relationships · Use CREATE TABLE statements

    A database consultant is designing a schema for a new inventory system. The system requires a table to store product categories where each category must have a unique numeric identifier that is automatically generated by the database upon insertion. The identifier should not allow gaps if the database restarts, even at the cost of performance. Which DDL strategy fulfills this requirement?

    Answer and explanation

    Correct answer: D

    To prevent gaps caused by caching during database restarts, the NOCACHE option must be used. The ORDER option ensures values are generated in order of request. GENERATED ALWAYS AS IDENTITY creates an internal sequence to populate the column automatically.

  2. Question 2

    Intermediate

    Using Functions · Apply the NVL, NULLIF, and COALESCE functions to data

    You are querying the SALES_DATA table to generate a report. You need to return the string 'No Commission' for any row where the COMMISSION_PCT column is NULL. If COMMISSION_PCT is not NULL, you must return the commission value converted to a string. Which function is best suited for this specific requirement?

    Answer and explanation

    Correct answer: A

    NVL takes two arguments. If the first is null, it returns the second. Since the second argument is a string literal ('No Commission'), the first argument must also be of character type (or implicitly convertible). Explicitly converting COMMISSION_PCT to CHAR ensures type compatibility.

  3. Question 3

    Intermediate

    Retrieving Data using the SQL SELECT Statement and Restricting and Sorting Data · Demonstrate how to use rules of precedence for operators in an expression

    Review the following query structure intended to filter employee records.

    SELECT employee_id, last_name
    FROM employees
    WHERE job_id = 'IT_PROG'
    OR job_id = 'AD_PRES'
    AND salary > 15000;
    

    Which statement accurately describes how the database interprets the precedence of operators in this query?

    Answer and explanation

    Correct answer: D

    The AND operator has higher precedence than OR. Therefore, job_id = 'AD_PRES' AND salary > 15000 is evaluated first. The result is then combined with job_id = 'IT_PROG' using OR.

  4. Question 4

    Beginner

    Use DDL to manage tables and their relationships · Explain the TRUNCATE TABLE statement

    You are performing a data cleanup operation. You need to remove all rows from the STAGING_LOGS table to free up storage space immediately. The operation must not generate undo logs for individual rows and cannot be rolled back. Which statement should you use?

    Answer and explanation

    Correct answer: B

    TRUNCATE TABLE is a DDL statement that removes all rows, resets the high-water mark, releases storage, generates minimal redo, and cannot be rolled back. DELETE is DML and generates undo.

  5. Question 5

    Intermediate

    Using Functions · Use DATE functions

    A developer needs to calculate the number of months between two dates: start_date and end_date. The result should be precise, including the fractional part of the month if the days differ. Which function should be used?

    Answer and explanation

    Correct answer: C

    MONTHS_BETWEEN returns the number of months between two dates. If the days of the month are different, it calculates the fractional portion of the month based on a 31-day month.

  6. Question 6

    IntermediateMultiple answers

    Displaying Data from Multiple Tables · Show understanding of using CARTESIAN PRODUCTS

    Which of the following scenarios describes the creation of a Cartesian Product (Cross Join) in a SQL query? (Select TWO)

    Answer and explanation

    Correct answers: B, D

    Explicitly using the CROSS JOIN keywords instructs the database to produce a Cartesian product.

    A Cartesian product occurs when every row in the first table is joined to every row in the second table. This happens if the join condition is invalid or omitted entirely, or explicitly requested via CROSS JOIN.

Register free for 6 more questions

Or unlock all 135 1Z0-171 questions with explanations, timed mode and flashcards.