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
-
Cursors
-
Database triggers
-
Procedure
-
None of these
B
Correct answer
Explanation
Database triggers are used to define code that is executed / fired when certain actions or events occur.
-
Inner join
-
Equi-join
-
Non-equi join
-
Outer join
D
Correct answer
Explanation
An outer join selects all the rows from one table whether they have corresponding matching rows in another table or not.
-
inner join
-
left join
-
full join
-
self join
-
cartesian join
D
Correct answer
Explanation
This type of join in relation algebra is used to join a table to itself if the table were two tables and temporarily renaming at least one table in the SQL statement.
-
open addressing
-
chaining
-
multiple hashing
-
collision
-
address space
D
Correct answer
Explanation
Collision occurs in internal hashing, when the hash field value of a record that is being inserted hashes to an address that already contains a different record.
-
Referential integrity
-
Domain integrity
-
Entity integrity
-
Trigger
-
DDL
B
Correct answer
Explanation
This integrity constraint in database is also called attribute integrity that allows size values, right data type and null status, etc.
-
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.
-
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.
-
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.