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

Multiple choice general knowledge foreign languages
  1. Control

  2. Alter

  3. Delete

  4. Insert

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

The French verb 'effacer' means 'to delete' or 'to erase' in English. This is a fundamental computing action for removing files or text. Control, alter, and insert are different computer operations, not the meaning of effacer.

Multiple choice general knowledge
  1. Create new records in tables

  2. Modify the properties of the database objects

  3. Change the appearence of the database objects

  4. View records in queries

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

In Design View, you can modify object properties (like field settings, control properties) and change appearance (fonts, colors, layout). Creating new records happens in Datasheet View, and viewing query records is done in Query View results.

Multiple choice general knowledge
  1. Table Wizard

  2. Primary Key

  3. Design View

  4. Datasheet View

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

Datasheet View in MS Access allows you to create a table by simply typing data into a spreadsheet-like grid. Access automatically creates the table structure and assigns data types based on what you enter. Table Wizard guides you through table creation but requires more steps. Design View is for manually defining fields and properties before data entry.

Multiple choice general knowledge science & technology
  1. SQL cannot support object-orientation

  2. The same query can be written in many ways, each with vastly different execution plans

  3. SQL syntax is too difficult for non-computer professionals to use

  4. SQL creates excessive locks within the database

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

A major problem with SQL is that the same query can be written in multiple syntactically correct ways, each producing vastly different execution plans and performance characteristics. This makes optimization challenging and query performance unpredictable. SQL does support some object-oriented features, the syntax is designed for professionals, and locking behavior is configurable.

Multiple choice general knowledge sports
  1. Primary key access

  2. Access via unique index

  3. Table access by ROWID

  4. Full table scan

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

Table access by ROWID is the fastest method for Oracle to retrieve a single row because ROWID is the physical address of the row in the database. Accessing directly by physical address avoids the overhead of index traversal or scanning multiple rows. Full table scan is the slowest, while primary key and unique index access are faster than full scans but still require index lookup overhead.

Multiple choice general knowledge sports
  1. 1

  2. 2

  3. 3

  4. 0

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

In the given SQL query, multiple columns are concatenated using the string concatenation operator (||) and separated by commas, but the entire resulting expression is given a single column alias "Adress". Therefore, the query returns only 1 column in its result set.

Multiple choice general knowledge science & technology
  1. MySQL

  2. Postgres

  3. Both

  4. None of these

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

MySQL supports unsigned integer datatypes like INT UNSIGNED, BIGINT UNSIGNED which allow only non-negative values and effectively double the positive range. PostgreSQL does not have native unsigned integer types - it uses signed integers with CHECK constraints for similar functionality.

Multiple choice general knowledge science & technology
  1. YES

  2. NO

  3. Cannot predict

  4. Not applicable

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

MySQL is not 100% ACID compliant because ACID properties depend on the storage engine being used. Only InnoDB provides full ACID compliance with transactions, foreign keys, and crash recovery. Engines like MyISAM lack transaction support entirely.

Multiple choice general knowledge math & puzzles
  1. REMOVE FROM CUSTOMER …

  2. DROP FROM CUSTOMER …

  3. DELETE FROM CUSTOMER WHERE …

  4. UPDATE FROM CUSTOMER …

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

DELETE FROM is the correct SQL command to remove rows. The syntax requires specifying the table and optionally a WHERE clause. DROP removes entire tables, UPDATE modifies data, and REMOVE is not a valid SQL command.

Multiple choice softskills teamwork
  1. SUM(start_date)

  2. AVG(start_date)

  3. COUNT(start_date)

  4. AVG(start_date, end_date)

  5. MIN(start_date)

  6. MAXIMUM(start_date)

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

For DATE columns in Oracle, only COUNT, MIN, and MAX are valid aggregate functions because they work with ordered data and counting. SUM and AVG require numeric values to calculate totals and averages, which cannot be performed on dates. MAXIMUM (option F) is incorrect Oracle syntax - it must be MAX.

Multiple choice softskills teamwork
  1. SELECT TO_DATE (SYSDATE, 'FMDAY, DD Month, YYYY') FROM dual;

  2. SELECT TO_CHAR (SYSDATE, 'FMDD, DY Month, YYYY') FROM dual;

  3. SELECT TO_CHAR (SYSDATE, 'FMDay, DD Month, YYYY') FROM dual;

  4. SELECT TO_CHAR (SYSDATE, 'FMDY, DDD Month, YYYY') FROM dual;

  5. SELECT TO_DATE (SYSDATE, 'FMDY, DDD Month, YYYY') FROM dual;

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

TO_CHAR is used to format dates into strings. 'FMDay' ensures the day is capitalized and removes extra padding, while 'DD Month, YYYY' provides the day number, full month name, and year. TO_DATE is incorrect because it converts a string to a date, not a date to a formatted string.

Multiple choice softskills teamwork
  1. CASCADE

  2. UNIQUE

  3. NONUNIQUE

  4. CHECK

  5. PRIMARY KEY

  6. NOT NULL

Reveal answer Fill a bubble to check yourself
B,D,E,F Correct answer
Explanation

Oracle constraint types are PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK, and NOT NULL. Options B, D, E, and F are all valid constraint types that enforce data integrity rules. CASCADE is a referential action, not a constraint type itself. NONUNIQUE is not a standard Oracle constraint.