1.
Which of the following are attributes of /SQL*Plus?
Correct Answer(s)
C. /SQL*Plus commands are used to manipulate data in tables.
D. /SQL*Plus commands manipulate table definitions in the database.
Explanation
The correct answer is /SQL*Plus commands are used to manipulate data in tables.,/SQL*Plus commands manipulate table definitions in the database. This is because SQL*Plus is a command-line tool that allows users to interact with the Oracle database. It provides a set of commands that can be used to manipulate data in tables, such as inserting, updating, and deleting records. Additionally, SQL*Plus commands can also be used to manipulate table definitions, such as creating, altering, and dropping tables in the database.
2.
Evaluate this SQL*Plus command:
START delaccount
Which task will this command accomplish?
Correct Answer
B. It runs the DELACCOUNT.SQL script file.
Explanation
The SQL*Plus command "START delaccount" will run the DELACCOUNT.SQL script file. This command is used to execute a SQL script file in SQL*Plus. By specifying the name of the script file after the "START" command, SQL*Plus will read and execute the commands in the script file. Therefore, the given command will run the DELACCOUNT.SQL script file.
3.
Which /SQL*Plus feature can be used to replace values in the WHERE clause?
Correct Answer
A. Substitution variables
Explanation
Substitution variables in SQL*Plus can be used to replace values in the WHERE clause. They allow users to dynamically substitute values into SQL statements at runtime. By using the "&" symbol followed by the variable name, users can prompt for input and replace the variable with the entered value in the WHERE clause. This feature provides flexibility and allows for more interactive and customizable queries.
4.
Evaluate this SQL statement:
SELECT c.customer_id, o.order_id, o.order_date, p.product_name
FROM customer c, curr_order o, product p
WHERE customer.customer_id = curr_order.customer_id
AND o.product_id = p.product_id
ORDER BY o.order_amount;
This statement fails when executed. Which change will correct the problem?
Correct Answer
D. Use the table aliases instead of the table names in the WHERE clause.
Explanation
The correct answer is to use the table aliases instead of the table names in the WHERE clause. In the given SQL statement, table aliases are used for customer, curr_order, and product tables (c, o, p respectively). However, in the WHERE clause, the table names are used instead of the aliases. This causes the statement to fail when executed. By using the aliases in the WHERE clause, the problem can be corrected and the statement will execute successfully.
5.
Examine the description of the STUDENTS table:
STD_ID NUMBER(4)
COURSE_ID VARCHARD2(10)
START_DATE DATE
END_DATE DATE.
Which two aggregate functions are valid on the START_DATE column? (Choose two)
Correct Answer(s)
C. COUNT(start_date)
E. MIN(start_date)
Explanation
The START_DATE column is of the DATE data type. The COUNT function can be used to count the number of non-null values in the START_DATE column. The MIN function can be used to find the minimum value in the START_DATE column. The SUM and AVG functions are not valid for the DATE data type. Therefore, the correct answers are COUNT(start_date) and MIN(start_date).
6.
Which two tasks can you perform by using the TO_CHAR function?
Correct Answer
C. Convert ‘10’ to ‘10’
Explanation
The TO_CHAR function in SQL is used to convert a number or date to a character string. It is not used to convert between different data types or to convert words to numbers. In this case, the correct answer is "Convert '10' to '10'" because it demonstrates the usage of TO_CHAR to convert a character string to another character string.
7.
In which case would you use a FULL OUTER JOIN?
Correct Answer
D. D. You want all unmatched data from both tables.
Explanation
A FULL OUTER JOIN is used when you want to retrieve all unmatched data from both tables. This means that you want to include all rows from both tables, even if there is no match between the tables based on the join condition. This is useful when you want to compare two tables and identify the differences or inconsistencies between them.
8.
Which operator can be used in an outer join condition?
Correct Answer
D. D. AND
Explanation
The AND operator can be used in an outer join condition. This operator allows for the combination of multiple conditions in a join statement. In an outer join, the AND operator is used to specify additional conditions that must be met for the join to occur. By using the AND operator, you can join tables based on multiple criteria, resulting in a more specific and targeted join operation.
9.
Why do we use subquery?
Correct Answer
D. Retrieve data based on an unknown condition
Explanation
We use subqueries to retrieve data based on an unknown condition. Subqueries allow us to nest a query within another query, where the inner query is executed first and its result is used by the outer query to retrieve the desired data. This is particularly useful when we need to filter data based on a condition that cannot be determined in advance or when we need to compare values from different tables. By using subqueries, we can dynamically retrieve data based on the result of another query, making our queries more flexible and powerful.
10.
Examine the structure of the EMPLOYEES table:
EMPLOYEE_ID NUMBER Primary Key
FIRST_NAME VARCNAR2(25)
LAST_NAME VARCNAR2(25)
Which statement inserts a row into the table?
Correct Answer
C. INSERT INTO employees (employee_id)
VALUES (1000);
Explanation
The correct answer is INSERT INTO employees (employee_id) VALUES (1000). This statement inserts a row into the EMPLOYEES table by specifying the value for the employee_id column as 1000. The other options either do not provide a value for the primary key column or include additional columns that are not specified in the table structure.
11.
Which action will cause an automatic rollback?
Correct Answer
B. System crash
Explanation
A system crash can cause an automatic rollback because when a system crashes, it loses all the data that was not yet committed. This means that any changes made to the database during that session will be lost and rolled back to the previous state. Therefore, a system crash triggers an automatic rollback to maintain data integrity and consistency.
12.
Examine this statement:
SELECT student_id, gpa FROM student_grades WHERE gpa > &&value;
You run the statement once, and when prompted you enter a value of 2.0. A report is
produced. What happens when you run the statement a second time?
Correct Answer
C. A report is produced that matches the first report produced.
Explanation
When the statement is run for the second time, a report is produced that matches the first report produced. This is because the condition in the WHERE clause of the statement is comparing the "gpa" column with the entered value of 2.0. As long as there are records in the "student_grades" table with a "gpa" greater than 2.0, those records will be included in the report. The statement does not prompt for a new value or ask whether to use the previous value.
13.
Which best describes an inline view?
Correct Answer
D. A subquery that is part of the FROM clause of another query
Explanation
An inline view is a subquery that is part of the FROM clause of another query. It is used to create a temporary table that can be used in the main query. This allows the main query to access and manipulate the data from the subquery as if it were a table. Inline views are useful when complex calculations or filtering needs to be done on a subset of data before joining it with other tables or performing further operations.
14.
The user Alice wants to grant all users query privileges on her DEPT table. Which SQL statement
accomplishes this?
Correct Answer
D. GRANT select ON dept TO PUBLIC;
Explanation
The correct answer is "GRANT select ON dept TO PUBLIC". This statement grants the SELECT privilege on the DEPT table to all users in the PUBLIC group. By granting the privilege to PUBLIC, it allows all users to query the DEPT table. The other options mentioned do not grant the privilege to all users or use incorrect syntax.