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 technology databases
  1. Default constraint

  2. Column data type

  3. Column name

  4. Table name

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

When creating a table, the table name, column names, and column data types are all required - a table cannot exist without them. A default constraint is optional because columns can be created without default values. NULL/NOT NULL is also optional but not listed among the choices.

Multiple choice technology databases
  1. Index

  2. Check constraint

  3. Default constraint

  4. Referential constraint

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

A default constraint only provides a fallback value when no value is specified - it doesn't restrict which values can be inserted. Check constraints restrict values to specific conditions. Referential constraints (foreign keys) restrict values to existing values in another table. Indexes can enforce uniqueness via unique constraints but don't restrict values otherwise.

Multiple choice technology databases
  1. When it is created

  2. When it is referenced in an INSERT statement

  3. Any time an executable SQL statement references it

  4. The first time any executable SQL statement references it

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

Views are virtual tables that don't store data - they execute the underlying query each time they're referenced. A view populates dynamically whenever any executable SQL statement (SELECT, INSERT, UPDATE, DELETE) references it. Views don't cache results and don't populate at creation time.

Multiple choice technology databases
  1. True

  2. False

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

The answer is False because while rowid provides fast access, it's not recommended as a primary key in NPS. Rowids can change during operations like DELETE and INSERT, making them unreliable as permanent identifiers. Best practice is to use explicit surrogate keys or natural keys that remain stable. Rowid is useful for performance but not as a primary key.

Multiple choice technology databases
  1. True

  2. False

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

The statement is False because NPS doesn't support this ALTER TABLE syntax. NPS has limited ALTER TABLE capabilities and doesn't allow adding columns with this syntax. In NPS, you typically need to recreate the table to add columns. The statement looks like SQL from other databases but doesn't work in NPS.

Multiple choice technology databases
  1. single quote

  2. semicolon

  3. double quote

  4. colon

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

The semicolon is the standard SQL command terminator in nzsql (Netezza's SQL interface, similar to PostgreSQL). It signals to the SQL parser that the command is complete and ready for execution. Quotes are for string literals, not command termination.

Multiple choice technology web technology
  1. True

  2. False

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

D-List itemnames CAN be imported directly from database tables. Cognos Analyst provides import functionality where you can map database columns to D-List items, pulling values directly from external data sources. This is a common practice when populating planning models with existing master data from operational systems. The statement claims they cannot be imported, which is false.