Computer Knowledge
Database and SQL
3,929 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
-
Get_group_row_count System Variables
-
Get_group_col_count System Variables
-
Get_row_count System Variables
-
Get_col_count System Variables
A
Correct answer
Explanation
The built-in system variable Get_group_row_count in Oracle Reports specifically returns the number of rows in a group. This is used for conditional logic, calculations, and formatting that depends on group size.
-
Primary Key Foreign Key Join
-
Primary Key Candidate Key Join
-
Candidate Key Foreign KeyJoin
-
None of the above
D
Correct answer
Explanation
A complex join in OBI EE is defined using a logical SQL expression in a WHERE clause (using AND, OR, CASE, etc.) rather than simple key-based relationships. It's not based on PK-FK, PK-CK, or CK-FK relationships alone - those describe simple foreign key joins.
A
Correct answer
Explanation
COBOL SORT statement supports sorting on multiple keys using ASCENDING/DESCENDING KEY syntax with multiple field names separated by commas.
A
Correct answer
Explanation
To answer this question, the user needs to know what the SEARCH ALL operation does and if it requires sorted tables.
The SEARCH ALL operation is used to find a specific record in a table that matches a given key value. It starts searching from the beginning of the table and stops when it finds the first matching record. If the table is not sorted, the search operation will have to check every record in the table, which can be slow and inefficient.
Therefore, the correct answer is:
The Answer is: A. True.
SEARCH ALL can only be applied to sorted tables for efficient search operations.
D
Correct answer
Explanation
Microsoft SQL Server uses port 1433 as the default port for database connections. Port 1434 is used for the SQL Server Browser service.
-
Cursor
-
Varchar2
-
PL/SQL table
-
Table of records
-
Record
D
Correct answer
Explanation
For bulk data operations in PL/SQL, a table of records (declared as TYPE t_tab IS TABLE OF table_name%ROWTYPE) is the most efficient mechanism. It allows storing entire rows from a table in a PL/SQL collection variable. A cursor only points to rows, varchar2 stores single values, a record holds one row, and a PL/SQL table (index-by table) is less efficient than a table of records for bulk operations.
A
Correct answer
Explanation
Oracle allows up to 12 distinct triggers per table: 4 timing levels (BEFORE/AFTER) × 2 events (INSERT/UPDATE/DELETE) × 2 levels (statement/row) for UPDATE, plus INSERT and DELETE at row and statement levels. This gives INSERT (2), UPDATE (4), DELETE (2), and 4 more variations totaling 12.
-
Truncate
-
Merge
-
Revoke
-
Grant
A
Correct answer
Explanation
TRUNCATE is a DDL (Data Definition Language) operation because it removes all rows and resets storage, performing an implicit commit that cannot be rolled back. MERGE is DML (combines INSERT/UPDATE/DELETE). REVOKE and GRANT are DCL (Data Control Language) statements for permissions.
-
select distinct * from T1
-
select C1 from T1 order by C2
-
select distinct C1 from T1
-
select 12*14 from T1
-
select C1 AS 'column1",C1 AS 'column2',C2 AS 'column1' from T1.
B
Correct answer
Explanation
Option B is incorrect because it uses ORDER BY C2 without C2 being in the SELECT list, which is invalid Oracle SQL. The other options are valid: DISTINCT can be used with * or specific columns, arithmetic expressions in SELECT are allowed, and column aliases can be repeated though it's poor practice.
-
Truncate
-
Merge
-
Revoke
-
Grant
B
Correct answer
Explanation
MERGE is a DML (Data Manipulation Language) statement that combines INSERT and UPDATE operations based on a condition. TRUNCATE is DDL (removes data, resets storage). REVOKE and GRANT are DCL (Data Control Language) for managing permissions.
A
Correct answer
Explanation
This statement is TRUE in Oracle SQL. You can ORDER BY columns that are not in the SELECT list - the sorting is performed before the final projection. This allows sorting by attributes you don't need to display, which is valid SQL syntax.
-
floor
-
sum
-
variance
-
stddev
A
Correct answer
Explanation
Functions like sum, variance, and stddev are aggregate or group functions that operate on sets of rows to return a single summary value. Conversely, floor is a single-row numeric scalar function, making it incorrect as a group function.
A
Correct answer
Explanation
In Oracle, readers never block writers and writers never block readers due to multiversion read consistency. When rows are locked by DML operations, other sessions can still query those rows using the before-image from undo segments. This prevents SELECT statements from waiting for row locks to be released.
A
Correct answer
Explanation
Oracle allows reference to SYSDATE, NEXTVAL, and CURRVAL in constraint definitions. These pseudocolumns and sequence functions can be used in DEFAULT, CHECK constraints and other constraint definitions. For example, a DEFAULT SYSDATE constraint or a check constraint using CURRVAL is valid.