Oracle SQL Test 1 — Questions and Answers
Question 1: Keywords can't be split across lines or truncated.
- False
- True (Correct answer)
Correct answer: True
In Oracle SQL, keywords are reserved words that have specific meanings and functions within the language. These keywords must be written as complete, unbroken units and cannot be split across multiple lines or truncated. This rule ensures that the SQL parser can correctly interpret the commands and execute the query as intended.
Question 2: Which clause limits the query to rows that fulfill a set of criteria?
- Order by
- Distinct
- Where (Correct answer)
- Describe
Correct answer: Where
The `WHERE` clause in SQL is specifically used to filter the rows returned by a query, limiting the result set to only those rows that satisfy a specified condition or set of criteria. It evaluates a boolean expression for each row and includes only the rows for which the expression is true. Other clauses like `ORDER BY` sort the results, and `DISTINCT` removes duplicates, but `WHERE` is for row-level filtering.
Question 3: Which of the following statements concerning Column Alias is incorrect?
- Is Oracle vendor specific (Correct answer)
- Is useful with calculations
- Renames a column heading
- Requires double quotation marks if it contains spaces or special characters or if it is case-sensitive
Correct answer: Is Oracle vendor specific
Column aliases are a standard feature in SQL, used to rename a column heading in the query's output for better readability, especially when dealing with complex expressions or calculations. They are not Oracle vendor-specific but are part of the ANSI SQL standard. If an alias contains spaces, special characters, or needs to be case-sensitive, it must be enclosed in double quotation marks.
Question 4: Which of the following statements about subquery operators is correct?
- The NOT IN operator is equivalent to IS NULL.
- The IN operator cannot be used in single-row subqueries
- =ANY and =ALL operators have the same functionality.
- The <ANY operator means less than the maximum. (Correct answer)
Correct answer: The <ANY operator means less than the maximum.
The `<ANY` operator in SQL subqueries means that the value being compared is less than at least one of the values returned by the subquery. This effectively means the value is less than the maximum value present in the subquery's result set. For example, `salary < ANY (SELECT salary FROM employees WHERE department_id = 10)` would return employees whose salary is less than the highest salary in department 10.
Question 5: The columns to be shown are identified by_______, while the table containing columns is identified by _______ .
- From and select (Correct answer)
- From and table
- Where and select
- Select from
Correct answer: From and select
In a standard SQL `SELECT` statement, the `SELECT` clause is used to identify the specific columns that you want to display in your query's output. Conversely, the `FROM` clause is used to specify the table or tables from which these columns and their corresponding data should be retrieved. This fundamental structure dictates what data is shown and where it originates.
Question 6: Grant and Revoke commands are _____
- Transaction control
- Data control language (DCL) (Correct answer)
- Data definition language (DDL)
- Data manipulation language (DML)
Correct answer: Data control language (DCL)
`GRANT` and `REVOKE` commands fall under Data Control Language (DCL) in SQL. DCL commands are used to manage permissions and access rights to the database objects. `GRANT` is used to give specific privileges to users, while `REVOKE` is used to remove those privileges, ensuring data security and integrity.
Question 7: Except for the following priority areas, Oracle Database 11g has a lot of features.
- High availability (Correct answer)
- Search Option
- Manageability
- Security
Correct answer: High availability
Oracle Database 11g, like many enterprise database systems, prioritizes features related to high availability, manageability, and security to ensure robust and reliable operations. These are fundamental aspects of a production-grade database. While a 'Search Option' might be a feature within the database or an application built on it, it is not considered one of the core, overarching priority areas for the database's architecture and development in the same vein as the others.
Question 8: Except for the following, the relational model consists of:
- Data integrity for accuracy and consistency
- Coding java with Oracle easily (Correct answer)
- Set of operators to act on the relations
- Collection of objects or relations
Correct answer: Coding java with Oracle easily
The relational model, a foundational concept in database management, primarily consists of a collection of objects (relations or tables), a set of operators to manipulate these relations (like relational algebra), and data integrity rules to ensure accuracy and consistency. 'Coding Java with Oracle easily' refers to application development and connectivity, which is external to the fundamental definition and components of the relational model itself.
Question 9: A unique identifier for each row of data in a table is:
- Foreign keys
- Primary key (Correct answer)
- Universal key
- Unique key
Correct answer: Primary key
A primary key is a crucial constraint in a relational database that uniquely identifies each individual row of data within a table. It ensures that every record can be distinctly referenced and serves as the main identifier for that entity. Primary keys must contain unique values and cannot have NULL values.
Keywords can't be split across lines or truncated.