Computer Knowledge
Database and SQL
3,929 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
-
Exclusive locks
-
Update locks
-
Shared locks
-
Upgrading locks
-
Increment locks
B
Correct answer
Explanation
Update locks statement is used when transactions with unexpected read write locks are to be used.
-
Trader
-
PreparedStatement
-
Statement
-
Stock
-
Next()
B
Correct answer
Explanation
It has a group of methods, which sets the value of IN parameters.
-
getInputStream()
-
getXXX()
-
executeQuery()
-
next()
-
statement
B
Correct answer
Explanation
This method is used to access data from the ResultSet rows.
-
stock
-
getInputStream()
-
execute()
-
executeQuery()
-
next()
C
Correct answer
Explanation
This method executes an SQL statement that may return multiple results.
-
Q only
-
P only
-
Both P and Q
-
Both P and R
-
R only
A
Correct answer
Explanation
Statement Q is correct because primary key and foreign key can exist in the same relation. Moreover, foreign key can refer to the primary key in the same relation. So, this is correct.
-
P only
-
Both P and Q
-
Both P and R
-
Both Q and R
-
All of these
C
Correct answer
Explanation
Statement P is correct because a candidate key is a key that uniquely identifies a row in a relation. So, this cannot be null as it uniquely identifies a row. Statement R is correct because primary key is chosen from a set of candidate keys. In other words, all the candidate keys are the candidates for the primary key. So, in this way. all the candidate keys are primary keys. So, this is the correct answer. Statement Q is false because if the primary key is composed of more than one attribute, then these attributes are known as prime attributes, not super attributes.
-
Intersection
-
Cartesian product
-
Difference
-
Both (2) and (3)
-
All of these
D
Correct answer
Explanation
All of the given options are true. So, this is the correct choice.
-
Schema, Base and Table
-
Base, Table and Schema
-
Key, Base and Table
-
Schema, Table and View
-
None of these
D
Correct answer
Explanation
In SQL, DDL (Data Definition Language) includes CREATE commands. The three main database objects you can create are Schema (for organizing database objects), Table (for storing data), and View (for virtual tables based on queries).
-
SHUTDOWN trigger
-
Instead of trigger
-
View
-
AFTER DROP trigger
-
LOGOFF trigger
B
Correct answer
Explanation
It provides a transparent way of modifying view that cannot be modified directly through DML statements.
-
Recover
-
Mounting the database
-
Trigger
-
Member method
-
Static method
C
Correct answer
Explanation
It is a procedure that run implicitly when an INSERT, UPDATE or DELETE statement is issued against the associated table.
-
ROW trigger
-
Before trigger
-
Disabled trigger
-
BEFORE DROP trigger
-
Opening the database
A
Correct answer
Explanation
This type of trigger is fired each time, when the table is affected by the triggering statement.
-
Table
-
LOGOFF trigger
-
Enabled trigger
-
Disabled trigger
-
BEFORE DROP trigger
C
Correct answer
Explanation
It runs its trigger action if a triggering statement is issued and the trigger restriction evaluates to run.
-
Trigger action
-
Trigger event
-
Before trigger
-
SHUTDOWN trigger
-
Registration
A
Correct answer
Explanation
This part of the trigger is the procedure that contains the SQL statements and code to be run when a trigger statement is issued.
-
Only 1
-
Only 2
-
Only 3
-
1, 2 and 3
-
Only 1 and 2
B
Correct answer
Explanation
Sets of dictionary tables are created once the database is created.
-
integer
-
double
-
record set
-
no return value
A
Correct answer
Explanation
The executeUpdate(String s) method in JDBC returns an integer value representing the number of rows affected by the SQL operation (INSERT, UPDATE, DELETE). For CREATE TABLE or similar DDL statements, it typically returns 0.