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
-
A cursor defines a private area in memory, when SQL statements are executed.
-
Implicit cursor are created, when any DML operation occurs in the database.
-
Explicit cursors are executed by default.
-
Explicit cursors can process only one record at a time.
-
None of the above
C
Correct answer
Explanation
Explicit cursors are not executed by default. They are executed when SELECT statement is used to return more than one row.
-
Triggers are executed automatically when any associated DML operation is executed.
-
In row level trigger, an even is fired when any row is updated.
-
Cyclic cascading in triggers can crash the database.
-
DESC USER_TRIGGERS function is used to get information about the trigger.
-
None of the above
-
Stored procedure reduces network traffic.
-
Stored procedures provide security to the database.
-
Stored procedure provides maintainability to the application.
-
Stored procedures are limited to T/SQL only and produce somewhat complexity.
-
(1), (2) and (3) all are true.
E
Correct answer
Explanation
Yes, all of these are the advantages of stored procedure.
-
A primary key cannot be NULL.
-
A foreign key can be NULL.
-
A foreign key can have the same name as primary key.
-
A foreign key can have the name other than the primary key.
-
None of the above
E
Correct answer
Explanation
This is the right choice as all the above statements are true.
-
A view in database provides security.
-
A view can hide the complexity of data in the database.
-
A view can act as aggregate tables.
-
A view can join multiple tables and simplify them as a single table.
-
All of the above are true statements.
E
Correct answer
Explanation
This is the correct choice as all of the above choices are correct.
-
Transitive dependency exists in the 3rd normal form of database.
-
1st normal form ensures that there should be a unique identifier for each row.
-
3rd normal form should be in 2nd normal form.
-
Normalisation is used to eliminate redundant data.
-
None of the above
A
Correct answer
Explanation
No, it is not true as 3rd normal form is used to remove the transitive dependency from the database tables.
-
Logical data independence
-
Physical data independence
-
Integrity independence
-
View updation rule
-
None of the above
A
Correct answer
Explanation
Yes, this is the rule given by E.F. Codd determines that the user view should not change despite the logical structures (splitting of tables) has been changed.
-
COUNT
-
SUM
-
AVG
-
MAX
-
None of the above
A
Correct answer
Explanation
Yes, this function is used to return the number of values from the column that matches the specified criteria.
-
Drop
-
Delete
-
Truncate
-
Both (1) and (3)
-
None of the above
A
Correct answer
Explanation
Yes, by using drop command we can remove an object from the database and if we want to drop a table then all the table structure will be removed form the database and we can not get back it.
-
Indexes are used to retrieve the rows of the database table quickly.
-
Indexes are not useful for the tables having less data.
-
The check constraints in SQL defines the business rules that should be follow by all the rows of the database.
-
Both (1) and (3) are true.
-
All (1), (2) and (3) are true.
E
Correct answer
Explanation
Yes, all the three statements are true.
-
Group By clause
-
Having clause
-
Distinct clause
-
Like clause
-
None of the above
B
Correct answer
Explanation
Yes, by using Having clause, we can make a condition on the data, which are retrieved by the Group By clause.
-
SAVEPOINT
-
COMMIT
-
SET TRANSACTION
-
ROLLBACK
-
None of the above
B
Correct answer
Explanation
Yes, this transaction command is used to save the work that is performed by the transaction on the database.
-
DROP
-
SELECT
-
ALTER
-
INSERT
-
_
B
Correct answer
Explanation
The SELECT command is used to select data from a database and query the data from the database.
-
NULL
-
CHECK
-
UNIQUE
-
FOREIGN KEY
-
_
C
Correct answer
Explanation
When a column or set of columns is defined as unique to the database management system, the system verifies that each set of value is unique before assigning the constraint.
-
The order by clause removes duplicates.
-
Distinct clause is used to remove duplicate records.
-
Unique key has only one null value.
-
A primary key does not allow any null value.
-
None of the above
B
Correct answer
Explanation
Yes, distinct clause is used to remove duplicates form the result set.