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
-
The DML commands will be executed automatically by using this control.
-
SET AUTOCOMMIT; is used to create AUTOCOMMIT environment variable.
-
To split a long transaction into smaller units by setting some check points.
-
It is used to manage the changes in the database.
-
It is used to make the transaction safe.
A
Correct answer
Explanation
To execute a COMMIT automatically an INSERT, UPDATE or DELETE command is executed,
-
This exception must be raised explicitly.
-
DBMS_STANDARD.RAISE_APPLICATION_ERROR procedure is used to raise this exception.
-
This exception cannot be raised automatically when a program violates database rules or exceeds system-dependent limits.
-
This exception caused the memory problems in the database.
-
These exceptions are created according to user's requirement.
D
Correct answer
Explanation
User defined exception does not cause any memory specific problems in the database.
-
By using the EXECUTE keyword, one can execute these procedures.
-
By calling the method of the procedure from a PL/SQL block.
-
By providing external command.
-
By triggering the procedure.
-
By synchronising the procedure.
A
Correct answer
Explanation
This is a correct statement. EXECUTE is a basic command for that.
-
It is a procedure to manage one or more tasks at a time.
-
EXECUTE [or EXEC] procedure_name; can be used to execute the procedure.
-
procedure_name; can be used to execute the procedure.
-
One can pass parameters to procedures in three ways.
-
The header consists of the name of the procedure and the parameters declaration section of the procedure.
E
Correct answer
Explanation
The header does not have declaration section of procedure but the body section have it.
-
REF CURSOR type stores the RECORD type of cursor variables.
-
The compiler does not allow the weak type of cursor variables for queries.
-
Strong REF CURSOR types are less error-prone than weak types but less flexible.
-
The compiler allows only the weak types cursor variables for queries.
-
The compiler provides the specification of all the variables.
B
Correct answer
Explanation
The PL/SQL compiler does not allow to use the strongly typed cursor variables for queries that return rows that are not of the return type.
-
This parameter does not return an updated value each time for the subprogram.
-
This parameter returns a value to the calling program.
-
It can be assigned a value and its value can be read.
-
The actual parameter corresponding to an IN OUT formal parameter can be a constant.
-
The parameter values cannot be changed.
C
Correct answer
Explanation
This is correct and IN OUT can be updated and read for the assigned value.
-
In order to change a trigger, use either the SQL Developer tool Edit or the DDL statement.
-
The triggers state cannot be changed for the list of schema object types.
-
Triggers cannot be changed in the list of triggers.
-
Trigger cannot be used for managing the database operations in a frequent manner.
-
Triggers can be used for data synchronisation.
A
Correct answer
Explanation
SQL Developer tools are mostly used in changing triggers. DDL statements CREATE TRIGGER with the OR REPLACE clause are also used.
-
A system trigger cannot be defined on a schema or the database.
-
It is fired for each event associated with the owner of the schema (the current user).
-
It is fired before the triggering event executes.
-
It is fired after each row that the event affects.
-
Triggers are fired when storage of data is performed.
B
Correct answer
Explanation
This is correct as the current user manages the transaction by own procedure.
-
When subscript exceeds the number of elements in a collection.
-
When a subscript is outside the allowed range.
-
When a subscript is null or not convertible to the key type.
-
When the user tries to operate on an atomically null collection.
-
When the user tries to check the authenticated value for the particular type.
A
Correct answer
Explanation
This is correct about SUBSCRIPT_BEYOND_COUNT exception.
-
Referential integrity
-
Entity integrity
-
Domain integrity
-
Select
-
Semi-Join
C
Correct answer
Explanation
This form of data integrity refers to the range of valid entries for a given column.
-
identifier
-
index
-
primary key
-
symmetric key
-
TRUNCATE is a DDL statement, while DELETE is a DCL statement.
-
TRUNCATE is a DML statement, while DELETE is a DDL statement.
-
TRUNCATE is a DML statement, while DELETE is a DCL statement.
-
TRUNCATE is a DDL statement, while DELETE is a DML statement.
-
TRUNCATE is a DCL statement, while DELETE is a DDL statement.
D
Correct answer
Explanation
TRUNCATE is a DDL (data definition language) statement, while DELETE is a DML (data manipulation language) statement.
-
Page number
-
Drop table
-
Key
-
Directory
-
Index
E
Correct answer
Explanation
Index stores the pointers of row as well as data stored in the row. It is used by RDBMS packages to quickly access rows of a table using the values of the columns.
-
It uniquely identifies a row in a table.
-
Its attributes cannot be duplicated in a row.
-
It cannot be null.
-
It is mandatory to provide input for the primary key attributes.
-
It can be a composite key.
C
Correct answer
Explanation
Primary key is chosen by a designer to uniquely identify rows in the table. It is always not null and unique. A null value can be used to represent an unknown data.
-
It is used to define the end of a transaction.
-
It defines change and drops the structure of a table.
-
It is used to modify and delete data from a table.
-
It has SELECT as a SQL keyword.
-
It can remove all rows from a table.
A
Correct answer
Explanation
Data control line (DCL) is a type of SQL statement. It is used to provide control over the data in a database and to define the end of a transaction.