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
-
In the itab you can store more than one same BP number
-
The internal table also treats the primary key in the same way.
-
All the above
-
None of the above
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.
-
LT & GT
-
GT & LT
-
GE & LE
-
LE & GE
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.
-
For telling the record is Included
-
For telling the record is updated
-
For telling the value is positive
-
For telling the value is negative
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.
-
Used for Internal table declaration
-
Used for Select-options declaration
-
Used for Select-options without Selection screen
-
Used for parameters without input screen
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.
-
It is a standard method to enforce information integrity
-
It is a standard method to manipulate data in databases
-
They are policies to enforce security access to database
-
Are method that allow users to authenticate
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.
-
When a field that is a primary key cannot be used a foreign key because of security policies
-
When a primary key is composed by more than field
-
When a primary key is a set of fields that are foreign keys
-
When a set of fields that are foreign keys are set as a primary key
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.
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.
-
represent primary key cloumn and assosciate attribute in domain object
-
map a table with the corresponding class
-
represent all attributes available in domain object
-
both 1 & 2
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.
-
imports name of database schema
-
permits to access all properties automatically
-
determines wether unqualified names can be used in query language
-
imports name of database catalog
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.
-
Integer
-
Binary
-
Char
-
Varchar
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.
-
ALL
-
ASYMMETRIC
-
LEADING
-
TRACING
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.
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.
-
auto_increment
-
sequence
-
identity
-
increment
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.