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

  2. CURSOR_ALREADY_OPEN

  3. TIMEOUT_ON_RESOURCE

  4. SYS_INVALID_ROWID

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

In PL/SQL, attempting to open a cursor that is already open raises the CURSOR_ALREADY_OPEN exception. This is a predefined exception that occurs when you try to open an already-open cursor without closing it first.

Multiple choice technology programming languages
  1. Language Integrated Query

  2. Language Independent Query

  3. Language Interrelated Query

  4. None of the above

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

LINQ stands for Language Integrated Query, a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages. It allows querying data from arrays, enumerable classes, XML documents, relational databases, and third-party data sources using a uniform syntax.

Multiple choice technology databases
  1. Only Alias

  2. Removing the unnecessary tables.

  3. Aliases or context

  4. Only Context

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

In data transformation scenarios involving multiple pipelines or circular references, loops can be resolved by using aliases (alternative names for tables) or by providing context that clarifies which version of a table to use at each point in the data flow. Simply removing tables or using only one method is not sufficient - you need both options available depending on the complexity of the mapping.

Multiple choice technology databases
  1. If database is having field whose length is more than 255 characters,

  2. While exporting data formatting is lost.

  3. a&b

  4. only b

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

Crystal Reports has known limitations including field length restrictions where database fields exceeding 255 characters can cause issues, and formatting loss when exporting data to certain formats. These are two distinct constraints that users encounter when working with Crystal Reports. The answer combines both limitations, acknowledging they both exist as problems.

Multiple choice technology databases
  1. SELECT * FROM Persons WHERE FirstName LIKE '%a'

  2. SELECT * FROM Persons WHERE FirstName ='a'

  3. SELECT * FROM Persons WHERE FirstName LIKE 'a%'

  4. SELECT * FROM Persons WHERE FirstName='%a%'

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

In SQL, the LIKE operator combined with the wildcard % is used for pattern matching. The pattern 'a%' matches any string that starts with the character 'a' followed by any sequence of characters. Other options either look for an exact match or look for strings ending with 'a'.

Multiple choice technology databases
  1. SELECT DIFFERENT

  2. SELECT DISTINCT

  3. SELECT UNIQUE

  4. SELECT SEPARATE

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

The SELECT DISTINCT statement is standard SQL syntax used to filter out duplicate rows and return only unique values from the query result. Commands like DIFFERENT, UNIQUE, and SEPARATE are not standard SQL keywords for removing duplicate records from a query result.

Multiple choice technology databases
  1. 1

  2. 2

  3. 3

  4. 4

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

The query uses the || operator to concatenate multiple address fields and string literals into a single output string. The alias 'Address' is assigned to this single combined expression, resulting in exactly one output column. Other options incorrectly count the source columns instead of the output columns.

Multiple choice technology databases
  1. It is a primary key for a Dimension table.

  2. It is a system generated sequence numbers

  3. It is a unique key

  4. It is a foreign key for a FACT table.

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

Surrogate keys are system-generated sequence numbers used as primary keys when natural keys don't exist. They're not foreign keys, dimension keys by definition, or necessarily unique (surrogate keys are always unique by design).

Multiple choice technology databases
  1. it'll display the result of which id=99999

  2. no rows selected

  3. Error

  4. garbage value...

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

The query contains id=99999 AND 1=0. Since 1=0 is always false, the entire WHERE condition evaluates to false regardless of the id value. SQL will return no rows, not an error. This is a valid query that simply matches no records.