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. Equi-join

  2. Natural join

  3. Outer join

  4. All of the above.

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

Outer joins are specifically designed to include rows that don't have matching values in the joined table. This includes LEFT JOIN (all from left table), RIGHT JOIN (all from right table), and FULL JOIN (all from both). Inner joins and equi-joins only return matching rows.

Multiple choice technology databases
  1. Both consist of procedural code

  2. Both have to be called to operate.

  3. Both run automatically.

  4. Both are stored in the database.

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

Both routines (stored procedures/functions) and triggers contain procedural code - SQL statements with control flow logic like IF/ELSE, loops, and variables. The key difference is invocation: routines must be called explicitly, while triggers execute automatically in response to events. Option A correctly identifies their shared characteristic.

Multiple choice technology databases
  1. Uses the result of an inner query to determine the processing of an outer query.

  2. Uses the result of an outer query to determine the processing of an inner query.

  3. Uses the result of an inner query to determine the processing of an inner query.

  4. Uses the result of an outer query to determine the processing of an outer query.

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

A correlated subquery is one where the inner query references a value from the outer query, making it dependent on the outer query's results. The inner query is executed repeatedly for each row processed by the outer query. This is the opposite of a non-correlated subquery, which runs independently once.

Multiple choice technology databases
  1. 1

  2. 2

  3. 3

  4. all of the above

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

SQL joins can theoretically involve any number of tables. While 2-table joins are most common (inner, left, right, full joins), you can join 3, 4, or more tables in a single query by chaining join conditions. The 'all of the above' option correctly captures that 1, 2, 3, or more tables are all possible.

Multiple choice technology databases
  1. You do not create them with SQL.

  2. They execute against only some applications that access a database.

  3. They have an event, condition, and action.

  4. They cannot cascade (cause another trigger to fire).

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

Triggers are defined by an event (like INSERT), an optional condition (WHEN), and an action (procedural statement). They are created using SQL, execute for all applications connecting to the database, and can cascade by triggering other events, making other options incorrect.

Multiple choice technology databases
  1. TRUE

  2. FALSE

  3. DO not know

  4. Both

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

When joining multiple tables, you generally need one join condition per pair of tables being joined to properly establish the relationship between them. For N tables, you typically need N-1 join conditions. Each condition connects two tables through matching keys. Without proper conditions, you risk a Cartesian product.

Multiple choice technology
  1. Proper relationship/ join should be created in Framework Manager

  2. Join has be created only in report studio

  3. Join has to be created in both in Framework Manager and Query studio

  4. Database constraints are enough

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

In Cognos Framework Manager, relationships and joins must be properly defined at the model level to ensure reports run correctly. Framework Manager creates the semantic layer that all reporting tools (Report Studio, Query Studio, Analysis Studio) depend on for accurate data retrieval and query generation.

Multiple choice technology
  1. We cannot specify cardinality

  2. We join all the tables to parameter variable

  3. We should check for loops and fan traps

  4. We cannot create a join between two dimension tables

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

When creating joins in Framework Manager, you must validate the model for loops (circular relationships that create infinite query paths) and fan traps (ambiguous many-to-one relationships through multiple paths). These structural issues cause incorrect query results or performance problems. Option A is wrong - cardinality can and should be specified. Option B is nonsense. Option D is incorrect - dimension tables can be joined.

Multiple choice technology
  1. True

  2. False

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

Framework Manager allows importing metadata from multiple data sources into a single model, enabling reporting across heterogeneous databases and systems. This is a key feature for enterprise data warehousing where data comes from various sources. The model can combine tables from different databases, defining relationships and joins across data source boundaries.

Multiple choice technology databases
  1. look up

  2. stored procedure

  3. both

  4. none

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

In Informatica PowerCenter, both Lookup and Stored Procedure transformations can be configured as unconnected (not connected to the pipeline, called via expressions). Since both lookup and stored procedure support this mode, selecting either one alone is incomplete, making 'both' the correct choice.

Multiple choice technology databases
  1. constraint based load

  2. e-mail

  3. target load plan

  4. none

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

Constraint-based load ordering uses primary key and foreign key relationships to determine the correct sequence for loading data into multiple related tables. This ensures parent records are loaded before child records to maintain referential integrity. E-mail is unrelated to data loading, and target load plan is a different concept.

Multiple choice technology databases
  1. DML

  2. DDL

  3. DRL

  4. DCL

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

CREATE, ALTER, DROP, and TRUNCATE are DDL (Data Definition Language) commands that define or modify database structure. CREATE makes new objects, ALTER changes structure, DROP removes objects, and TRUNCATE empties a table while keeping its structure. These commands work on the schema, not the data itself.

Multiple choice technology databases
  1. DDL

  2. DML

  3. DRL

  4. DCL

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

INSERT, UPDATE, and DELETE are DML (Data Manipulation Language) commands that manipulate the actual data within database tables. INSERT adds new rows, UPDATE modifies existing data, and DELETE removes rows. These operations work on the data content, not the table structure.

Multiple choice technology databases
  1. DRL

  2. DDL

  3. DML

  4. DCL

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

SELECT is classified as DRL (Data Retrieval Language) or DQL (Data Query Language) - a category that specifically handles querying and retrieving data from databases. Unlike DML (which modifies data) or DDL (which modifies structure), SELECT only reads data without making any changes to the database.