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
-
rollback
-
database administrator
-
parser
-
none of the above
C
Correct answer
Explanation
A parser is an SQL or Oracle translator who verfies the syntax of the SQL and query.
-
primary key
-
secondary key
-
foreign key
-
none of the above
C
Correct answer
Explanation
It links two relations or transactions.
-
Select * from table
-
Select distinct from table
-
Select column 1and column 2 from table
-
Select column 1 from table
B
Correct answer
Explanation
This is a correct query which shows only distinct data and no duplicate values.
-
Index
-
Cursor
-
Sequence
-
Trigger
D
Correct answer
Explanation
Triggers are SQL statements that are stored in the database catalog. Once triggers are activated by database events such as UPDATE, DELETE or INSERT, the triggers will execute either before or after the event that initiates them.
-
By select statement
-
By get statement
-
By retrieve statement
-
None of the above
A
Correct answer
Explanation
Select statement is used to fetch data from table and database or to process a data query.
-
By using cursors
-
By using query tree
-
By using singleton select
-
None of the above
B
Correct answer
Explanation
Query tree is an internal representation of SQL statements where the single parts that are built stored separately.
D
Correct answer
Explanation
The * is used to specify all the columns from the table in an SQL statement.
-
For level
-
For row level
-
For each row
-
None of the above
C
Correct answer
Explanation
Syntax for creating a ROW LEVEL TRIGGERcode - CREATE OR REPLACE TRIGGER<trigger name><BETORE|AFTER><ACTION>ON <table name>FOR EACH ROW (THIS IS CORERCT CLAUSE USED IN)
-
If all query processing is performed by the database system
-
Use of correct and exact syntax with respect to an SQL language embedded
-
Embedded SQL must follow RDBMS rules
-
Embedded SQL expression for database modifications always return a value
D
Correct answer
Explanation
It is not compulsary for SQL expression to return a value.
-
Primary Key
-
Secondary Key
-
Foreign Key
-
None of these
C
Correct answer
Explanation
Foreign key stores the primary key of others tables and is used for relationship.
-
Primary Key
-
Candidate Key
-
Super Key
-
Foreign Key
B
Correct answer
Explanation
Candidate Key is the only system guranteed way of pin pointing some specific tuple by some candidate key value.
-
COMMIT TRANSACTION
-
ROLL BACK TRANSACTION
-
(1) or (2)
-
None of these
C
Correct answer
Explanation
To SAVE and EXIT from the transaction, we should write COMMIT, or if we have made savepoint, then we have revert back then, make SAVEPOINT. So, we can make either COMMIT or SAVEPOINT according to the query.
-
Candidate key
-
Super key
-
Primary key
-
Both (1) and (2)
D
Correct answer
Explanation
Candidate keys are special subsets of superkeys that do not have any extraneous information in them. Each table may have one or more candidate keys. A superkey is a combination of attributes that can be uniquely used to identify a database record. A table might have many superkeys. Hence, both the options 1 and 2 are correct.
-
Referential integrity rule
-
Distinct rows in a table
-
Entity integrity rule
-
None of these
C
Correct answer
Explanation
(A Primary Key or part of it can not be null) - the rule says that 'null' is a special value in a relational database and it does not mean blank or zero.
-
It becomes super key.
-
It becomes candidate key.
-
It becomes foreign key.
-
It becomes primary key
A
Correct answer
Explanation
A superkey is a combination of attributes that can be uniquely used to identify a database record. A table might have many superkeys.