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
-
Char
-
Varchar(Max)
-
Int
-
Float
B
Correct answer
Explanation
During Sybase-to-SQL Server migrations, the Sybase text datatype is mapped to varchar(max) (or nvarchar(max) if Unicode is needed). Legacy datatypes like text are deprecated in modern SQL Server versions in favor of varchar(max).
-
Over Partition By
-
Over Group By
-
Both
-
None
A
Correct answer
Explanation
T-SQL allows columns in GROUP BY that are not in the SELECT list, but PL/SQL prohibits this. The OVER clause with PARTITION BY provides similar functionality in PL/SQL by allowing window functions without the restrictive GROUP BY requirement.
-
COLUMN = NULL
-
COLUMN is NULL
-
COLUMN in (Null, 0)
-
None
B
Correct answer
Explanation
MSSQL follows ANSI SQL standard for NULL comparisons using 'IS NULL' syntax. The equality operator (=) cannot be used with NULL values because NULL represents an unknown value, not a specific value to compare.
A
Correct answer
Explanation
Sybase allows SELECT statements to include columns that are not in the GROUP BY clause and are not aggregated. This is a Sybase-specific behavior that differs from ANSI SQL standard and most other databases.
B
Correct answer
Explanation
Sybase supports implicit type conversion, allowing date columns to be compared with varchar values. The database engine will attempt to convert the varchar value to a date type for comparison purposes.
-
varchar
-
int
-
text
-
binary
-
Image
C,E
Correct answer
Explanation
SQL Server has deprecated the legacy 'text' and 'Image' data types in favor of varchar(max) and varbinary(max). While still functional for backward compatibility, they are not recommended for new development. Varchar, int, and binary are fully supported modern types.
-
A procedure that is very small
-
A procedure being invoked by another procedure
-
A procedure that is not used by application
-
System stored procedures
B
Correct answer
Explanation
A child stored procedure is a procedure that is called (invoked) by another stored procedure. This is a common design pattern for modularizing complex database logic into reusable components.
-
timestamp
-
varchar
-
datetime
-
number
-
raw
C
Correct answer
Explanation
Oracle does not support the 'datetime' data type - it uses 'date' for date/time values and 'timestamp' for higher precision. Varchar, number, timestamp, and raw are all valid Oracle data types. This is a common source of confusion for developers migrating from other databases.
-
@@trancount
-
@@rowcount
-
@@sqlstatus
-
@@rescount
B
Correct answer
Explanation
@@rowcount returns the number of rows affected by the last statement in Sybase. This is a system variable used to check the impact of INSERT, UPDATE, or DELETE operations. @@trancount tracks transactions, @@sqlstatus is for cursor status, and @@rescount does not exist.
-
inserted
-
updated
-
deleted
-
created
A,C
Correct answer
Explanation
Magic tables in Sybase are virtual tables used in triggers to access the data being modified. 'inserted' contains new rows (for INSERT and UPDATE), and 'deleted' contains old rows (for DELETE and UPDATE). These tables exist only during trigger execution and are not permanent tables.
-
Tables
-
Stored Procedures
-
Triggers
-
Indexes and Views
-
All of the above
-
All except Indexes and Views
E
Correct answer
Explanation
Database conversion is a comprehensive process that requires migrating all schema elements, business logic, and access structures, including tables, stored procedures, triggers, indexes, and views, to ensure compatibility with the target database.
A
Correct answer
Explanation
In PEGA's Work Party rules, the Model column allows referencing a Model rule that defines default information for party fields. This Model rule populates default values on the PartyDisplay form, reducing manual data entry and ensuring consistency. The Model column is indeed optional, allowing flexible configuration.
-
Insert
-
Create
-
Delete
-
Select
-
Grant
-
Commit
D
Correct answer
Explanation
SELECT is the SQL statement used for data retrieval - it queries and returns data from database tables. Insert adds new data, Create defines structures, Delete removes data, Grant gives permissions, and Commit saves transactions - none of these are primarily for retrieval.
-
Insert
-
Create
-
Delete
-
Select
-
Merge
-
Update
A,C,E,F
Correct answer
Explanation
Data Manipulation Language (DML) statements modify data: Insert adds new rows, Delete removes rows, Merge combines insert/update/delete operations, and Update modifies existing data. Create is DDL (defines structure), Select is for retrieval not manipulation.
-
Alter
-
Rollback
-
Select
-
Commit
-
Rename
-
Savepoint
B,D,F
Correct answer
Explanation
Transaction Control Language (TCL) commands manage transactions: Rollback undoes changes, Commit permanently saves changes, and Savepoint sets intermediate rollback points. Alter and Rename are DDL structure commands, Select is for retrieval.