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 programming languages
  1. In the itab you can store more than one same BP number

  2. The internal table also treats the primary key in the same way.

  3. All the above

  4. None of the above

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

In ABAP, a standard internal table declared as 'type table of' does NOT enforce primary key uniqueness by default. Unlike database tables where primary keys must be unique, standard internal tables allow duplicate entries. You can indeed store multiple records with the same BP number in such an internal table. Option B is incorrect because internal tables do not enforce primary key constraints the same way database tables do.

Multiple choice technology programming languages
  1. LT & GT

  2. GT & LT

  3. GE & LE

  4. LE & GE

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

SELECT-OPTIONS in ABAP define a range table with LOW and HIGH values. The default operators that work with select options are LE (Less than or Equal) for the LOW value and GE (Greater than or Equal) for the HIGH value. This creates an inclusive range. Options A, B, and C show different operator combinations that are not the standard default for SELECT-OPTIONS. The LE & GE combination (option D) is the correct pairing.

Multiple choice technology programming languages
  1. For telling the record is Included

  2. For telling the record is updated

  3. For telling the value is positive

  4. For telling the value is negative

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

In ABAP SELECT-OPTIONS, the SIGN field determines whether the selection criteria range should include or exclude records. The value 'I' stands for inclusive, signifying that matching records are included, whereas the other options regarding updates, positive, or negative values are incorrect.

Multiple choice technology programming languages
  1. Used for Internal table declaration

  2. Used for Select-options declaration

  3. Used for Select-options without Selection screen

  4. Used for parameters without input screen

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

The RANGES keyword in SAP ABAP declares a selection table (similar to SELECT-OPTIONS) without creating an input field on the selection screen. This is useful when you need to work with ranges of values programmatically rather than accepting user input. Option A is incorrect because RANGES is not for internal tables. Option B describes SELECT-OPTIONS, which does create a selection screen. Option D refers to PARAMETERS, not RANGES.

Multiple choice technology databases
  1. It is a standard method to enforce information integrity

  2. It is a standard method to manipulate data in databases

  3. They are policies to enforce security access to database

  4. Are method that allow users to authenticate

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

A constraint is a rule enforced at the database level to maintain data integrity and ensure information accuracy. Constraints prevent invalid data entry (like NOT NULL prevents nulls, UNIQUE prevents duplicates, CHECK validates values). Option B is incorrect because constraints don't manipulate data - that's what DML statements do. Option C confuses constraints with security policies. Option D confuses constraints with authentication mechanisms.

Multiple choice technology databases
  1. When a field that is a primary key cannot be used a foreign key because of security policies

  2. When a primary key is composed by more than field

  3. When a primary key is a set of fields that are foreign keys

  4. When a set of fields that are foreign keys are set as a primary key

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

A superkey is a set of one or more attributes that can uniquely identify tuples in a relation. The question describes a composite primary key (one made of multiple fields) but calls it a 'superkey' - this is terminology confusion. A composite primary key IS a type of superkey, but the standard definition doesn't mention security policies or foreign keys. The question's phrasing is imprecise but option B is the closest to describing a multi-attribute key.

Multiple choice technology programming languages
  1. True

  2. False

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

Hibernate does use identifiers internally for object persistence and identity management. The statement refers to the potential trade-off where relying on database-generated identifiers might reduce some application flexibility compared to application-assigned identifiers.

Multiple choice technology programming languages
  1. represent primary key cloumn and assosciate attribute in domain object

  2. map a table with the corresponding class

  3. represent all attributes available in domain object

  4. both 1 & 2

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

The element in Hibernate mapping files maps a persistent Java class to its corresponding database table. The first option describes the element mapping the primary key, and the third option describes properties, meaning the fourth option combining them is also incorrect.

Multiple choice technology programming languages
  1. imports name of database schema

  2. permits to access all properties automatically

  3. determines wether unqualified names can be used in query language

  4. imports name of database catalog

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

The auto-import attribute in Hibernate's `` element determines whether unqualified class names can be used in HQL. By default, it is true, allowing developers to query entities without their full package path. The distractors incorrectly refer to database schemas, catalogs, or property access permissions.

Multiple choice technology
  1. Integer

  2. Binary

  3. Char

  4. Varchar

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

Surrogate keys are typically implemented as integers (often auto-incrementing or sequence-generated) because they provide efficient storage, fast join performance, and carry no business meaning. They are not character-based like natural keys, nor binary like some system identifiers.

Multiple choice technology programming languages
  1. ALL

  2. ASYMMETRIC

  3. LEADING

  4. TRACING

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

In ESQL, ALL, ASYMMETRIC, and LEADING are reserved keywords with specific SQL meanings. TRACING is not a reserved keyword in ESQL - it can be used as an identifier name. Reserved keywords cannot be used as identifiers without quoting, while non-reserved words like TRACING have no special meaning.

Multiple choice technology databases
  1. True

  2. False

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

FULL JOIN (or FULL OUTER JOIN) returns all rows when there is a match in either table - it returns matched rows from both tables, plus unmatched rows from each table padded with NULLs. This differs from INNER JOIN (only matches) or LEFT/RIGHT JOIN (matches plus unmatched from one side). The statement accurately describes FULL JOIN behavior of returning rows when there's a match in at least one of the tables.

Multiple choice technology databases
  1. auto_increment

  2. sequence

  3. identity

  4. increment

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

In Oracle, auto-increment functionality is implemented using SEQUENCE objects, not the auto_increment keyword used in MySQL. A sequence generates unique numeric values that can be used for auto-incrementing primary keys through triggers or direct insertion. Option A is MySQL syntax, Option C is SQL Server/PostgreSQL syntax, and Option D is not a valid keyword in this context.