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
-
DATETIME
-
SMALLDATETIME
-
INT
-
VARCHAR
C
Correct answer
Explanation
For SQL Server 2000, the DATETIME type only supports dates from January 1, 1753 onwards, which cannot store historical dates like February 22, 1732. Storing dates as INT (days since a reference point) or VARCHAR allows working with pre-1753 dates. This is a SQL Server-specific limitation.
-
2000/02/29
-
2000/03/01
-
44
-
An error is generated. A DATETIME value and an INT value cannot be added together. Use the DATEADD function for this purpose.
C
Correct answer
Explanation
The expression 2000/02/25 is interpreted as integer division (2000 divided by 2 divided by 25), not as a date. 2000/2 = 1000, then 1000/25 = 40. So 40 + 4 = 44. To add days to a date, you must use the DATEADD function with a proper DATETIME value.
C
Correct answer
Explanation
SE16 is the transaction code for Data Browser in SAP, used to view table data. SE11 is for ABAP Dictionary (data dictionary maintenance), SE38 is for ABAP Editor (writing programs), and SE06 is for Workbench Organizer.
-
In SAP Easy access screen enter the transaction code in Command field
-
If you are not in SAP Esy access screen enter /N followed by the transaction code in command field
-
If you want to open a transaction in new session, enter /O followed by transaction codein command field
-
Go to the appropriate menu and explore to find your transaction and execute
A,B,C,D
Correct answer
Explanation
All four methods are standard ways to execute a transaction in SAP. You can run codes directly in the Easy Access command field, use /N to exit and run from another screen, use /O to open a new session, or navigate the SAP menu hierarchy.
-
Used to uniquely identify a row
-
Alias for primary key
-
Used to identify a column
-
Alias for foreign key
A
Correct answer
Explanation
A candidate key is a minimal set of attributes that uniquely identifies each row in a table. A table can have multiple candidate keys, and one is selected as the primary key.
-
Dymanic
-
Real
-
Virtual
-
Static
C
Correct answer
Explanation
To solve this question, the user needs to know about views in database management systems. A view is a virtual table that does not store any data but only displays data from one or more tables in the database.
Based on this information, the correct answer is:
The Answer is: C. Virtual
-
Using COUNT
-
Using NUM
-
Using NUMBER
-
Both a and c above
A
Correct answer
Explanation
SQL uses the COUNT aggregate function to return the number of rows in a table, either as COUNT(*) or COUNT(column_name). NUM and NUMBER are not valid SQL aggregate functions.
B
Correct answer
Explanation
Outer joins (LEFT, RIGHT, FULL) do NOT require matching records - they return all records from one or both tables, with NULLs filling in for non-matching rows. Only inner joins require matches on both sides.
A
Correct answer
Explanation
A table can have multiple UNIQUE constraints, each enforcing uniqueness on a different column or combination of columns. This is different from a PRIMARY KEY, of which a table can only have one. UNIQUE constraints are commonly used on columns like email, username, or phone number where duplicates should not occur.
-
To limit the output of a query
-
To limit the output of a query using an aggregate function only
-
When GROUP by is used
-
both b and c above
-
Table
-
Column
-
Database
-
All the above
-
KEY FIELD
-
SEARCH FIELD
-
BOTH
-
NONE
A
Correct answer
Explanation
In database design, a key field (or sequence field) is used to uniquely identify and sequence records or segments. Once set, its value generally cannot be altered to maintain database integrity and structure. Search fields are used for querying data and can be modified, making other options incorrect.
-
TRYING TO CHANGE KEY
-
NO PRECEDING GET HOLD CALL
-
REPLACE RULE VIOLATION
-
ALL THE ABOVE
B
Correct answer
Explanation
In IMS DL/I status codes, DJ specifically indicates that a program attempted to perform an operation (typically Replace or Delete) that requires a GET HOLD call, but no preceding GET HOLD was issued. The 'D' status codes relate to DL/I call errors. This is a common error when programs try to update segments without properly locking them first with a GET HOLD call.
-
Java
-
Custom
-
SQL
-
Update strategy
C
Correct answer
Explanation
SQL Transformation allows dynamic execution of SQL queries at runtime, making it ideal for updating target column values based on complex logic or lookups that can't be handled by standard transformations. Unlike Update Strategy which only flags records for insert/update/delete, SQL Transformation can execute actual UPDATE statements with dynamic conditions.
-
The aggregate expression uses nested aggregate functions.
-
The session uses incremental aggregation.
-
Only option 'a' is true
-
None of the above is true