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
C
Correct answer
Explanation
Views in SQL can be created with the CHECK OPTION to make them read-only, and can join multiple tables. Views can have ORDER BY in some databases (though with limitations), and GROUP BY is allowed. Column aliases are optional - the view can use original column names.
-
SQL CODE 100
-
SQL CODE -911
-
SCLCODE -811
-
SQLCODE -305
A
Correct answer
Explanation
SQLSTATE 20000-29999 range indicates execution warnings. SQLSTATE 02000 specifically means 'No data found' which corresponds to SQLCODE 100 in DB2 and other databases - this is returned when a SELECT retrieves no rows or cursor reaches end of data.
-
Header
-
Static
-
Dynamic
-
All of the above
D
Correct answer
Explanation
A table row can be declared as a header row (for titles/column headers), a static row (with fixed content), or a dynamic row (generated from data sources). All three declaration types are valid in table systems.
-
PreparedStatement
-
ParameterizedStatement
-
ParameterizedStatement and CallableStatement
-
All kinds of Statements (i.e. which implement a sub interface of Statement)
-
Use the specified table as the "Last" table in the join
-
Use the specified table as the "Log" table in the join
-
Use the specified table as the "Driving" table in the join
-
Use the query as the "First" query in the set.
C
Correct answer
Explanation
The LEADING hint explicitly tells the query optimizer to use the specified table as the driving table in the join order. The driving table is the first table accessed in the join execution plan, which can significantly impact performance.
-
select * from utlxplan;
-
select * from plan_table;
-
select plan from plan_table;
-
select * from table(dbms_xplan.display);
B,D
Correct answer
Explanation
Oracle provides two primary methods for retrieving execution plans: querying the PLAN_TABLE directly (which stores the plan) or using the DBMS_XPLAN.DISPLAY function for formatted output. The utlxplan view is outdated, and plan_table requires specific column selection.
-
allows Logical Rowid's to remain independent of physical rowid's
-
allows rows to move across partitions
-
allows rows to be physically located in a different tablespace, while remaining tagged to a partition
-
allows rows to be copied to non-partitioned tables
B
Correct answer
Explanation
ENABLE ROW MOVEMENT permits rows to move between partitions when their partition key values are updated. Without this clause, updating a partition key would fail because rows cannot naturally change partitions without explicit permission for row movement.
-
Online Redifinition method
-
Hybrid Method
-
Export/Import Method
-
Insert with a Subquery method
-
Dump Exchange Method
-
Partition Exchange method
A,C,D,F
Correct answer
Explanation
Oracle provides four primary methods for partitioning existing tables: Online Redefinition (using DBMS_REDEFINITION for minimal downtime), Export/Import (traditional data movement), Insert with Subquery (data transfer between tables), and Partition Exchange (metadata-only swap with pre-built partitions).
-
WITH UR
-
WITH ROLLBACK
-
WITH CONTINUE
-
WITH HOLD
D
Correct answer
Explanation
In DB2 and similar SQL databases, the WITH HOLD option on a cursor prevents the cursor from closing when a COMMIT operation is performed. Without this option, cursors close automatically at commit, requiring them to be reopened. WITH HOLD maintains cursor position across transaction boundaries.
-
Normalizer
-
Custom
-
Expression
-
Router
B
Correct answer
Explanation
While Update Strategy is the primary transformation for flagging rows, Custom (or Custom Transformation) can also be used to set row flags for insert, update, delete, and reject operations. Custom transformations allow you to write procedural code that can manipulate row flags based on complex business logic that might be difficult to express in Update Strategy expressions alone. This provides flexibility when complex conditional logic determines how rows should be treated.
C
Correct answer
Explanation
To join 4 tables using Joiner transformations in Informatica, you need 3 Joiner transformations. Joiner transformations only accept two input sources (master and detail). The process is hierarchical: join Tables A and B (Joiner 1), join that result with Table C (Joiner 2), then join that result with Table D (Joiner 3). Each joiner reduces the number of data streams by one, so for n tables, you need n-1 joiners.
-
Intent
-
Shared
-
Exclusive
-
Delete
A,B,C
Correct answer
Explanation
SQL Server uses Intent locks (IS, IX), Shared locks (S), and Exclusive locks (X) as fundamental locking mechanisms. These prevent concurrent access conflicts. 'Delete' is an operation that acquires locks, not a lock type itself.
-
RD entry
-
INITIATE statement
-
SELECT clause
-
TERMINATE statement
C
Correct answer
Explanation
In COBOL Report Writer functionality, the report name appears in the RD (Report Description) entry, INITIATE statement, and TERMINATE statement. The SELECT clause is part of the Environment Division's FILE-CONTROL paragraph and is used for file selection, not report selection - it does not contain report names.
-
T-Regualr Table, A-attachment
-
T-Regular Table, B-attachment
-
H-history, T- regualr, B-attachment
-
T-Regualr, H-History, A-attachment
B,C
Correct answer
Explanation
In Remedy ARS database schema, forms use specific table prefixes: 'T' for the main data table (regular/form table), 'B' for attachment blob data, and 'H' for history/audit trail. Therefore 'T-Regular Table, B-attachment' (Option B) is correct, and 'H-history, T- regualr, B-attachment' (Option C) is also correct as it includes all three table types.
A
Correct answer
Explanation
In ARS database, each attachment requires two tables: one for attachment metadata (fields, size, name, etc.) and one for the actual binary/blob data. This separation allows efficient storage and retrieval of attachment information without loading the entire binary content when only metadata is needed.