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
-
On any DML
-
On any DDL
-
On both
-
On none
B
Correct answer
Explanation
Autocommit occurs automatically when DDL (Data Definition Language) statements like CREATE, ALTER, DROP are executed. DML (Data Manipulation Language) statements like INSERT, UPDATE, DELETE require explicit COMMIT unless autocommit mode is specifically enabled. DDL statements cannot be rolled back in Oracle, which is why they trigger automatic commits.
-
The column is populated by sequence
-
The column contains many different values
-
The column is mainly used for value range scans
-
The columns implementing an inverted list attribute.
A
Correct answer
Explanation
Reverse key indexes are specifically designed for columns populated by sequences. When sequences generate ascending values (1, 2, 3...), normal B-tree indexes cause contention on the rightmost leaf block. Reverse key indexes reverse the bytes of each value, distributing inserts across different leaf blocks and eliminating this hotspot. They're not ideal for range scans (option C) or for high-cardinality columns without sequential insert patterns.
-
MANAGER must be a role.
-
It allows the MANAGER to pass the specified privileges on to other users.
-
It allows the MANAGER to create tables that refer to the STUDENT_GRADES table.
-
It allows the MANAGER to apply all DML statements on the STUDENT_GRADES table.
-
It allows the MANAGER the ability to select from, insert into, and update the STUDENT_GRADES table.
-
It allows the MANAGER the ability to select from, delete from, and update the STUDENT_GRADES table.
B,E
Correct answer
Explanation
The WITH GRANT OPTION clause allows the grantee (MANAGER) to both exercise the granted privileges (SELECT, INSERT, UPDATE on STUDENT_GRADES) and grant those same privileges to other users. Option B correctly describes the GRANT OPTION aspect, while option E correctly describes the privileges granted. MANAGER can be either a user or a role.
-
A Schema Object
-
A subquery that can contain an ORDER BY clause
-
Another name for a view that contains group functions
-
A subquery that is part of the FROM clause of another query
D
Correct answer
Explanation
An inline view is a subquery that appears in the FROM clause of a SELECT statement and is treated as a table during query execution. It is not a schema object (that's a regular view), can contain ORDER BY, and is not specifically related to group functions.
-
A MERGE statement is used to merge the data of one table with data from another.
-
A MERGE statement replaces the data of one table with that of another.
-
A MERGE statement can be used to insert new rows into a table.
-
A MERGE statement can be used to update existing rows in a table.
-
String
-
Character
-
Integer
-
Date
-
Numeric
-
Conversion
-
Line 1
-
Line 2
-
Line 3
-
Line 4
-
Local list
-
Field value
-
Remote list
-
Prompt list
-
Class key value
B
Correct answer
Explanation
In Maximo property tables, 'field value' (using synonym/domain tables) is the best choice for small to medium-sized lists that change frequently. It offers good performance and easy maintenance. Local lists (A) are only for very small, static lists. Remote lists (C) are for external systems, prompt lists (D) require user input, and class key values (E) serve different purposes.
-
Rule-Declare-Index
-
Rule-Declare-OnChange
-
Rule-Declare-Constraints
-
Rule-Declare-Trigger
B
Correct answer
Explanation
Rule-Declare-OnChange is specifically designed in Pega to run activities automatically whenever the value of a specified property changes. Rule-Declare-Index is for improving database query performance, Rule-Declare-Constraints defines validation rules, and Rule-Declare-Trigger executes activities when objects are created, updated, or deleted - not specifically for property value changes.
-
a. View is a named SQL query stored in data dictionary
-
b. View is a database object which stores data
-
c. View is used for data hiding
-
d. Views doesn’t occupy memory
A,C,D
Correct answer
Explanation
Views are virtual tables based on SQL queries stored in the data dictionary (option A correct). They do NOT store data themselves - data remains in underlying tables (option B incorrect). Views provide data hiding by restricting access to specific columns or rows (option C correct). Views don't occupy additional storage memory as they don't duplicate data (option D correct).
A
Correct answer
Explanation
DML operations (INSERT, UPDATE, DELETE) can be performed on some views, but not all. Updatable views must meet conditions: derived from a single table, no DISTINCT, GROUP BY, aggregates, or computed columns. The modifications affect the underlying base tables. Simple views are generally updatable, complex views may be read-only.
B
Correct answer
Explanation
A cross join (cartesian product) between tables A and B produces rows equal to (rows in A) × (rows in B). With 10 rows in A and 0 rows in B, the result is 10 × 0 = 0 rows. When one table is empty, the cross join returns an empty result set.
-
SELECT * FROM test_chk ;
-
select * from test_chk where name1 like '%%\%' escape ''
-
select * from test_chk where name1 like ' \ ' escape '';
-
select * from test_chk where name1 like '%!%%' escape '!'
A,D
Correct answer
Explanation
To find a literal '%' in SQL LIKE, you need an escape character. Option A (SELECT *) works but returns ALL rows inefficiently. Option D uses '!' as escape - '%!%%' means: any characters, then literal % (escaped as %!), then any characters. Option B is wrong (syntax error), and C doesn't match the pattern.
-
SELECT * FROM test_chk ;
-
select * from test_chk where name1 like '%%\%' escape ''
-
select * from test_chk where name1 like ' \ ' escape '';
-
select * from test_chk where name1 like '%!%%' escape '!'
A
Correct answer
Explanation
You can add a NOT NULL column to a table with existing data if you provide a DEFAULT value. Without a default, the operation would fail because existing rows would have NULL values for the new column. The question is technically true but omits the important default value requirement.