Oracle Database SQL — Question 65
Which set of commands will prompt only once for the name of the table to use in the query?
Answer options
- A. PROMPT Enter table name &x - SELECT employee_id FROM &x WHERE last_name = ‘King’;
- B. DEFINE x = ‘employees’ PROMPT Enter table name &x - SELECT employee_id FROM &x WHERE last_name = ‘King’;
- C. PROMPT Enter table name &x - SELECT employee_id FROM &&x WHERE last_name = ‘King’;
- D. PROMPT Enter table name &&x - SELECT employee_id FROM &x WHERE last_name = ‘King’;
Correct answer: D
Explanation
Option D is correct because it uses '&&' which allows the prompt to ask for the table name only once and then use the defined variable in the query. Option A and C incorrectly use a single '&' which would prompt multiple times. Option B is irrelevant as it defines a variable without prompting the user for input.