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 databases
  1. *#\$*#\$sql function
  2. error

  3. *#$*#sql functions
  4. None of the above

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

lpad pads the string 'sql functions' (13 chars) on the left to reach 18 characters using pattern '#$'. The pattern repeats: '#$#$' (6 chars) + 'sql functions' (12 chars) would be 18, but we need exactly 18. The pattern '#$#' (5 chars) + 'sql functions' (13 chars) = 18 characters. Option C shows '#$*#sql functions' which is the correct padding.

Multiple choice technology packaged enterprise solutions
  1. Joins are between two tables

  2. Joins cannot be updated

  3. Joins are used in multi value groups

  4. Joins are created in the client

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

SQL joins fundamentally operate between two tables (or table-like objects) by matching related columns. While some databases support joining more than two tables in a single query, the basic join operation always involves exactly two tables at its core. Joins are server-side operations and can be part of updatable views.

Multiple choice technology packaged enterprise solutions
  1. Custom Table

  2. Intersect Table

  3. Interface Table

  4. Data Table

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

In database table classification, a Custom Table is a private table created and owned by a specific user or application, not shared across the system. Intersect tables handle many-to-many relationships, Interface tables facilitate data exchange, and Data tables are general-purpose shared tables.

Multiple choice technology databases
  1. 1

  2. error

  3. null

  4. 0

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

The INSTR function searches for a substring within a string. With start_position=-1, it searches backwards from the end of the string. The occurrence parameter specifies which occurrence to find. Since 'd' exists in 'oracle' at position 15, the function should return 15. However, if the function returns 0, it could indicate either the substring was not found or there's a specific behavior with negative start positions that depends on Oracle version. The correct answer depends on actual Oracle behavior.

Multiple choice technology packaged enterprise solutions
  1. Adding positions is only allowed by a primary team member.

  2. Adding positions is only allowed when the project is locked

  3. Adding positions is only allowed when connected to server

  4. Adding positions is only allowed when the local database is locked

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

In database systems that support local caching, adding positions typically requires an active server connection to ensure data consistency and synchronization. When disconnected, the local database is often read-only to prevent conflicts. Options A, B, and D are incorrect because team member roles, project locks, and database locks do not control this fundamental connectivity requirement.

Multiple choice technology databases
  1. 18

  2. 19

  3. 21

  4. none of the above

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

The SQL query uses LENGTH() function on the string 'This is Ram''s book'. The double quote ('') in SQL represents a single literal quote character. Counting: T-h-i-s- -i-s- -R-a-m-'-s- -b-o-o-k = 18 characters. The LENGTH function counts all characters including spaces and the apostrophe.

Multiple choice technology databases
  1. 1x4y6789

  2. 1xy456789

  3. 1xy46789

  4. error

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

TRANSLATE('source', 'from', 'to') replaces each character in 'from' with corresponding character in 'to'. Here: '235' maps to 'xy' (2→x, 3→nothing, 5→y). So '123456789' becomes '1xy46789' - 2 becomes x, 3 is removed, 5 becomes y. The key is understanding that 3 maps to empty string.