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
-
Table
-
Column
-
Database
-
All the above
C
Correct answer
Explanation
The USE keyword in SQL selects a database as the active context for subsequent operations. For example, 'USE company_db;' makes 'company_db' the default database so you don't need to prefix table names. It does not select tables or columns; those are selected with SELECT statements.
-
KEY FIELD
-
SEARCH FIELD
-
BOTH
-
NONE
A
Correct answer
Explanation
In database design, a key field (or sequence field) is used to uniquely identify and sequence records or segments. Once set, its value generally cannot be altered to maintain database integrity and structure. Search fields are used for querying data and can be modified, making other options incorrect.
-
Java
-
Custom
-
SQL
-
Update strategy
C
Correct answer
Explanation
SQL Transformation allows dynamic execution of SQL queries at runtime, making it ideal for updating target column values based on complex logic or lookups that can't be handled by standard transformations. Unlike Update Strategy which only flags records for insert/update/delete, SQL Transformation can execute actual UPDATE statements with dynamic conditions.
-
The aggregate expression uses nested aggregate functions.
-
The session uses incremental aggregation.
-
Only option 'a' is true
-
None of the above is true
-
Using lookup override
-
Cannot join tables without using Joiner or Source qualifier override
-
Using user defined option in source qualifier
-
Using SQL Transform
-
waitfor delay '0:0:5'
-
Select * from ;--
-
‘ OR ‘1’=’1
-
OR 1=1
A
Correct answer
Explanation
Blind SQL injection reveals no data in responses, so testers use time-based techniques like WAITFOR DELAY (SQL Server) or sleep() (MySQL) to confirm vulnerability. If injection succeeds, the delay occurs. Options C and D work in reflected injection where results appear in page output. Option B causes errors regardless. Time-based observation (A) is definitive for blind scenarios.
-
A flat file called "plan_table.txt"
-
Oracle Table called "plan_table"
-
Oracle Table called "plan table"
-
A flat file called "plan_table.tbl"
B
Correct answer
Explanation
In Oracle, EXPLAIN PLAN results are written by default to a table named "plan_table" (with an underscore), not to flat files or space-separated names like "plan table". This allows querying and formatting of execution plans using DBMS_XPLAN.
-
It's advisable to choose the driving table with maximum number of records
-
Number of records is NOT the criteria while selecting driving table
-
It's advisable to choose the driving table with less number of records
-
Driving table is always the last table accessed by the Optimizer
C
Correct answer
Explanation
In join operations, the driving table (accessed first by the optimizer) should typically be the smaller table or the one with the most selective filter condition. This minimizes intermediate result sets and improves overall join performance.
-
Optimizer will return parse error if expressions are used on columns in the predicate
-
Optimizer does not use index if expressions are used on the columns in the predicate, even if one exists
-
It makes no difference with / without expressions on the columns in the predicate
-
Using expressions on the columns in the predicate won't get benefits of using Table Alias
B
Correct answer
Explanation
When you apply functions or expressions to indexed columns in WHERE clauses (e.g., WHERE UPPER(name) = 'TEST'), the optimizer cannot use the index on that column. This forces a full table scan instead of an efficient index range scan, severely degrading performance.
-
Combines multiple scans
-
Reduce number of calls to the database
-
Performs many small scans as compared to one large scan
-
Makes more smaller calls to the database as compared to one large call
A,B
Correct answer
Explanation
CASE expressions in SQL let you implement conditional logic within a single statement. This allows you to combine what would otherwise be multiple queries or scans into one operation, reducing roundtrips to the database and overall execution time.
-
HASH JOIN
-
SORT UNIQUE
-
TABLE FULL ACCESS
-
INDEX RANGE SCAN
B
Correct answer
Explanation
UNION performs a SORT UNIQUE operation to eliminate duplicate rows from the combined result set, which requires sorting. UNION ALL skips this sorting and deduplication step, simply concatenating all rows from both queries. This makes UNION ALL faster when you don't need to remove duplicates.
-
RSU01
-
SU01
-
ZUSERLIST
-
RSMO
C
Correct answer
Explanation
ZUSERLIST is a custom SAP transaction code designed to retrieve and display user IDs created on a specific date in the BI environment. SU01 is the standard user maintenance transaction but doesn't provide date-filtered listing capability. RSU01 and RSMO are not the correct transactions for this purpose - they serve other functions in SAP systems.
-
Create statement
-
Prepared Statement
-
Callable Statement
-
Synchronized statement
D
Correct answer
Explanation
JDBC provides three types of statements for executing SQL: Statement (basic SQL execution), PreparedStatement (precompiled SQL with parameters), and CallableStatement (for stored procedures). "Synchronized statement" is not a JDBC concept - synchronized is a Java keyword for thread synchronization, unrelated to database operations.
C
Correct answer
Explanation
A UNION query requires that corresponding columns in both select statements have compatible data types. Here, the first SELECT returns a numeric value (1) while the second returns a character value ('A'), resulting in a data type mismatch error.
-
Error
-
Last record
-
First record
-
Can't be decided.
B
Correct answer
Explanation
When all rows have been fetched from a cursor and another fetch is issued, the cursor continues to return the last record. It does not throw an error or return to the first record.