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

Multiple choice technology security
  1. waitfor delay '0:0:5'

  2. Select * from ;--

  3. ‘ OR ‘1’=’1

  4. OR 1=1

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. A flat file called "plan_table.txt"

  2. Oracle Table called "plan_table"

  3. Oracle Table called "plan table"

  4. A flat file called "plan_table.tbl"

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. It's advisable to choose the driving table with maximum number of records

  2. Number of records is NOT the criteria while selecting driving table

  3. It's advisable to choose the driving table with less number of records

  4. Driving table is always the last table accessed by the Optimizer

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. Optimizer will return parse error if expressions are used on columns in the predicate

  2. Optimizer does not use index if expressions are used on the columns in the predicate, even if one exists

  3. It makes no difference with / without expressions on the columns in the predicate

  4. Using expressions on the columns in the predicate won't get benefits of using Table Alias

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. Combines multiple scans

  2. Reduce number of calls to the database

  3. Performs many small scans as compared to one large scan

  4. Makes more smaller calls to the database as compared to one large call

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. HASH JOIN

  2. SORT UNIQUE

  3. TABLE FULL ACCESS

  4. INDEX RANGE SCAN

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology packaged enterprise solutions
  1. RSU01

  2. SU01

  3. ZUSERLIST

  4. RSMO

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. 66

  2. 77

  3. 88

  4. 01

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Level 66 is specifically designated for the RENAMES clause in COBOL. This clause allows you to give an alternative name to a contiguous group of elementary items or to reorganize existing data items. Level 77 is for independent items, 88 for condition names, and 01 for record definitions.

Multiple choice technology
  1. Create statement

  2. Prepared Statement

  3. Callable Statement

  4. Synchronized statement

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. 10th row

  2. 1st row

  3. no rows returned

  4. First 10 rows

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

To solve this question, the user needs to have basic knowledge of SQL and the concept of the rownum keyword in SQL.

The rownum keyword is used to assign a unique number to each row returned by a query in Oracle. It is often used to limit the number of rows returned by a query.

Now, let's go through each option and explain why it is right or wrong:

A. 10th row: This option is incorrect. The rownum keyword assigns a unique number to each row returned by a query. However, the where clause in the given SQL limits the result set to only the row where rownum equals 10. This means that the SQL query will only return one row, and that row will be the 10th row in the result set.

B. 1st row: This option is incorrect. The where clause in the given SQL limits the result set to only the row where rownum equals 10. This means that the SQL query will only return one row, and that row will be the 10th row in the result set.

C. no rows returned: This option is incorrect. The SQL query will return one row, which is the 10th row in the result set.

D. First 10 rows: This option is incorrect. The where clause in the given SQL limits the result set to only the row where rownum equals 10. This means that the SQL query will only return one row, and that row will be the 10th row in the result set.

The Answer is: C

Multiple choice technology databases
  1. 10-JUL-00

  2. 12-JUL-00

  3. 11-JUL-00

  4. 14-JUL-00

  5. 17-JUL-00

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

NEXT_DAY finds the first occurrence of the specified day after the given date. Starting from Monday July 10, the next Monday is July 17. The format mask 'DD-MON-RR' gives 17-JUL-00. The other options are incorrect dates.