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. Single-row Functions and Double-row Functions

  2. One-row Functions and Two-row Functions

  3. Single-row Functions and Multiple-row Functions

  4. None of the above

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

SQL functions are categorized into single-row functions (operate on one row at a time, like UPPER, SUBSTR) and multiple-row functions (operate on groups of rows, like SUM, COUNT, AVG). This classification determines how they're used in queries.

Multiple choice technology databases
  1. Table1.column1=Table2.column2

  2. Table1.column1=Table2.column1

  3. Table1.column2=Table2.column1

  4. None of the above

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

An equi-join is a join based on equality between columns, typically joining on the same column name from different tables. Option B shows Table1.column1 = Table2.column1, which represents an equi-join condition where the same column from both tables is being compared for equality.

Multiple choice technology databases
  1. CHECK keyword

  2. WITH CHECK keyword

  3. WITH CHECK OPTION keyword

  4. None of the Above

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

The WITH CHECK OPTION clause on a view ensures that any DML operation (INSERT/UPDATE) cannot create rows that the view’s defining query would exclude, protecting against modifications outside the sub‑query’s scope. The other keywords do not provide this restriction.

Multiple choice technology databases
  1. INSERT statement

  2. UPDATE statement

  3. Both of the Above

  4. None of the Above

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

Explicit DEFAULT values can be specified in both INSERT and UPDATE statements to force a column to use its defined default when the supplied value is omitted or set to DEFAULT. Therefore the option indicating both statements is correct; the others omit one context.

Multiple choice technology databases
  1. No. of rows in a table

  2. No. of rows with non-null values of the expr

  3. No. of distinct non-null values of the expr

  4. None of the above

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

COUNT(DISTINCT expr) counts unique non-null values. Unlike regular COUNT which counts total rows, DISTINCT removes duplicates before counting. NULL values are always excluded from the count.

Multiple choice technology databases
  1. Group By

  2. NVL

  3. Order By

  4. Having

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

NVL replaces null values with a specified substitute before aggregation, forcing group functions like SUM or AVG to treat nulls as a concrete value. GROUP BY controls grouping, ORDER BY sorts results, and HAVING filters groups, none of which alter null handling within aggregates.

Multiple choice technology databases
  1. All rows of the Employee table

  2. Rows of the Employee table where the set grade is ‘Y’

  3. Delete 1 row

  4. Nothing will be deleted

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

DELETE with WHERE clause removes only rows matching the condition. It will delete all Employee rows where grade equals 'Y'. If no rows match, nothing is deleted.