Computer Knowledge
Database and SQL
4,213 Questions
Master structured query language commands, database joins, table constraints, and alias generation. This section covers relational database management concepts and query outputs essential for technical aptitude. These technical questions feature prominently in banking IT officer exams and computer knowledge sections.
SQL queries and aliasesDatabase table constraintsDatabase joins and transformationsStored procedures and functions
Database and SQL Questions
B
Correct answer
Explanation
Oracle sequences are independent of row count - they increment each time NEXTVAL is called in the SQL statement. A sequence might be incremented once per row, multiple times per row, or not at all depending on usage.
B
Correct answer
Explanation
Oracle DATE columns store both date and time components, precise to the second. When only a date is specified, the time portion defaults to midnight (00:00:00).
B
Correct answer
Explanation
The statement describes aggregate functions (GROUP BY) which return one row per group. Analytic functions use OVER() and maintain row granularity - they compute aggregates without collapsing rows.
B
Correct answer
Explanation
This is a duplicate of question 134468. The statement describes aggregate functions which collapse rows. Analytic functions compute aggregate values (like SUM, AVG) but return a result for each row, not collapsing the result set.
B
Correct answer
Explanation
The concatenation result depends on input types. If concatenating two CHAR values, Oracle returns CHAR. For VARCHAR2 inputs, it returns VARCHAR2. The statement incorrectly claims VARCHAR2 is always returned.
A
Correct answer
Explanation
Oracle supports hint comments like /*+ INDEX(tab idx) */ to pass optimizer directives. While hints are technically comments, their specific purpose in Oracle SQL is to guide the optimizer's execution plan.
-
Primary key access
-
Access via unique index
-
Table access by ROWID
-
Full table scan
A
Correct answer
Explanation
Triggers only execute for DML operations that occur after their creation. Any existing data in the table before the trigger was defined remains unchanged by the trigger logic.
B
Correct answer
Explanation
Database triggers execute within the context of the triggering DML statement's transaction. Using transactional control statements like COMMIT or ROLLBACK inside a trigger would attempt to end the parent transaction, causing runtime errors.
-
Cursor is a named Private SQL area
-
Cursor holds temporary results
-
Cursor is used for retrieving multiple rows
-
SQL uses implicit Cursors to retrieve rows
B
Correct answer
Explanation
A cursor IS a named private SQL area that holds temporary results and IS used for retrieving multiple rows. Option B claims it's 'not correct' to say a cursor holds temporary results, which is false - that's precisely what a cursor does.
-
Select … into
-
Update
-
Create
-
Delete
C
Correct answer
Explanation
In PL/SQL, Data Manipulation Language (DML) statements like SELECT...INTO, UPDATE, and DELETE are natively supported. However, Data Definition Language (DDL) statements like CREATE cannot be executed directly and must be run using dynamic SQL (EXECUTE IMMEDIATE).
B
Correct answer
Explanation
If multiple rows are inserted using SYSDATE in rapid succession (within the same second), they would have identical timestamp values, violating the UNIQUE constraint. The UNIQUE constraint prevents any duplicate values, including those from SYSDATE.
B
Correct answer
Explanation
DQL resembles SQL but is not a subset. It includes Documentum-specific features like ENABLE, OUT OF, and OBJECT() that are not part of standard SQL.
-
REGISTER
-
EXECUTE
-
BEGIN
-
COMMIT
B
Correct answer
Explanation
EXECUTE is the DQL statement used to run server-side methods. REGISTER is for procedures, BEGIN and COMMIT are transaction control.
B
Correct answer
Explanation
DQL (Data Query Language) is a subset of SQL that includes SELECT and related clauses for retrieving data. SQL also includes DDL (CREATE/ALTER/DROP), DML (INSERT/UPDATE/DELETE), DCL (GRANT/REVOKE), and TCL (COMMIT/ROLLBACK).