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
C
Correct answer
Explanation
SELECT is the primary SQL command for retrieving and querying data from databases. It specifies which columns to fetch and from which tables, with optional filtering and sorting.
-
DROP
-
DELETE
-
TRUNCATE
-
REMOVE
-
ERASE TABLE
A
Correct answer
Explanation
This option is correct as DROP TABLE command is used to remove a table definition and all data.
-
Alter
-
Revoke
-
Grant
-
Update
-
Drop
D
Correct answer
Explanation
This option is correct as DDL statements define the structure of the database but Update command changes the data in the database.
-
It is used to add an integrity constraint to a table.
-
It is used to redefine a column of the table.
-
It is used to change a table's storage characterstics.
-
It is used to create tables and definine columns.
-
It enables or disables integrity constraints.
D
Correct answer
Explanation
This option is correct as CREATE TABLE command creates a table in the database.
-
Delete
-
Select
-
Create
-
Insert
-
Update
C
Correct answer
Explanation
Create is a DDL statement as this statement defines the structure of a database.
-
TRIGGER
-
CREATE VIEW
-
UPDATE
-
GRANT
-
REVOKE
E
Correct answer
Explanation
The REVOKE command revokes previously granted privileges from one or more roles.
-
REVOKE
-
DROP
-
INSERT
-
GRANT
-
ALTER
D
Correct answer
Explanation
SQL GRANT is a command used to provide access or privileges of the database objects to other users.
-
CREATE TRIGGER
-
CREATE VIEW
-
CREATE TABLESPACE
-
GRANT
-
CREATE SYNONYM
A
Correct answer
Explanation
This option is correct as CREATE TRIGGER command is a SQL statement that creates a trigger to the database schema.
A
Correct answer
Explanation
This option is correct as AVG is a predefined SQL function that is used to calculate the average of a given record.
-
ALTER
-
ROLLBACK
-
GRANT
-
DROP
-
REVOKE
B
Correct answer
Explanation
This option is correct as transaction control commands manage the changes made by data manipulation commands.
-
WHERE
-
DISTINCT
-
SELECT
-
LIKE
-
GROUP BY
B
Correct answer
Explanation
This option is correct as this distinct keyword selects only those values that are unique.
-
PRIMARY KEY
-
FOREIGN KEY
-
COMPOSITE KEY
-
ALTERNATE KEY
-
DEFAULT
A
Correct answer
Explanation
This option is correct as primary key constraint does not allow duplicacy of data. Hence, it uniquely identifies each row in the table.
-
Alter table
-
Resize
-
Drop
-
Change Size
A
Correct answer
Explanation
The alter statement is used to resize a column. The size of a column can both be increased or decreased using the alter keyword. Normally, the size of a column can be increased to a large value but it can only be decreased to the limit that if there is data present in the column, it should not get trimmed.
-
Structured Question Lanaguage
-
Strurctured Queried Language
-
Structured Query Language
-
Structured Queries Language
C
Correct answer
Explanation
It is the language to handle basic database operations like creating a table and managing it. Some of the keywords of SQL are Create,Select, Delete, Update etc.. SQL is also sometimes called SEQUEL which stands for Simple English Like Query Language. SQL is supported by all the major RDBMS products like Oracle, Ms-SQL Server, MySQL to name a few.
-
& and *
-
% and *
-
% and _ (underscore)
-
$ and _ (underscore)
C
Correct answer
Explanation
The Like operator is used for pattern matching in VARCHAR columns. It is useful in conditions where we do not to compare a value exactly with another. For example, if we want to search for all the persons whose names start with A, we can use the Like operator with the wildcard character. % is used for substituting a string. For conducting a character replacement we can use the _ (underscore) operator. It is used for matching values that are of a particular length.