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. Selfjoin

  2. Outerjoin

  3. innerjoin

  4. equijoin

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

A self-join joins a table to itself, typically using table aliases to treat it as two separate copies. This is used for hierarchical data (employee-manager) or comparing rows within the same table. Option A correctly names this join type.

Multiple choice technology databases
  1. Single-row subquery, Double-row subquery

  2. Double-row subquery, Multiple-row subquery

  3. Multiple-row subquery

  4. Single-row subquery and Multiple subquery

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

Subqueries are classified as single-row (return one row) or multiple-row (return multiple rows). This classification determines which operators you can use: single-row operators (=, >, <) vs multiple-row operators (IN, ANY, ALL). Option D is correct despite slightly awkward phrasing.

Multiple choice technology databases
  1. Only one row

  2. Two rows

  3. Zero rows

  4. There is no such subquery

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

A single-row subquery returns exactly one row from the inner query, allowing use of single-row comparison operators like =, >, <, >=, <=, !=. If it returns zero or multiple rows, these operators will cause an error.

Multiple choice technology databases
  1. It gives the name and marks of all the students.

  2. It does not return anything.

  3. It shows an error saying” INVALID SYNTAX ERROR”

  4. It shows an error saying” Single-row subquery returns more than one row

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

The subquery uses GROUP BY Rollnum, which returns one row per unique Rollnum (multiple rows total). The outer query uses = (single-row operator), which cannot handle multiple results. This triggers the error 'single-row subquery returns more than one row'. Note: GROUPBY should be GROUP BY (missing space).

Multiple choice technology databases
  1. Add new rows to a table

  2. Modify existing rows of a table

  3. Remove existing rows from a table

  4. All of the above

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

DML (Data Manipulation Language) includes INSERT (add new rows), UPDATE (modify existing rows), and DELETE (remove existing rows). All three actions are DML operations, so 'All of the above' is correct.

Multiple choice technology databases
  1. Insert to table tablename (….);

  2. Insert into table tablename (….);

  3. Insert into table tablename values (…..);

  4. Any one of the above

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

Correct INSERT syntax is INSERT INTO tablename VALUES (...). Option A has 'Insert to' instead of 'Insert into'. Option B is missing the VALUES keyword. Option C is correct: INSERT INTO tablename VALUES (...). Note: Option C says 'Insert into table tablename' which has an extra 'table' - the standard is just 'INSERT INTO tablename VALUES (...)'.

Multiple choice technology databases
  1. Structured Query Language

  2. Standard Query Language

  3. System Query Language

  4. Simple Query Language

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

SQL stands for Structured Query Language, which is the standard language for relational database management systems. It's used for querying, manipulating, and defining data in databases.

Multiple choice technology databases
  1. Projection

  2. Selection

  3. Join

  4. All of the above

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

The SQL SELECT statement possesses three primary capabilities: selection, which filters rows using a WHERE clause; projection, which chooses specific columns to display; and joining, which combines data from multiple tables. Therefore, all of the listed capabilities are correct.