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
-
CREATE INTO
-
SELECT INTO
-
CREATE FROM
-
NONE OF THESE
B
Correct answer
Explanation
SELECT INTO is a SQL command (particularly in SQL Server) that creates a new table and populates it with the result set from a query, effectively creating a backup. CREATE INTO and CREATE FROM are not valid SQL syntax for this purpose.
-
is used with the DISTINCT SQL keyword only
-
is used with the INSERT SQL keyword only
-
determines if a value matches any of the values in a list or a sub-query
-
defines the tables we are selecting or deleting data from
C
Correct answer
Explanation
The IN operator in SQL tests whether a value matches any value in a specified list or any value returned by a subquery. It is not limited to DISTINCT or INSERT keywords, and FROM (not IN) defines the tables for SELECT or DELETE operations.
-
update only one row at a time
-
update more than one row at a time
-
delete more than one row at a time
-
delete only one row at a time
B
Correct answer
Explanation
The UPDATE statement modifies all rows that satisfy the WHERE clause. If the WHERE condition matches multiple rows (or is omitted entirely), the UPDATE affects all matching rows simultaneously, not just one.
-
Disable the triggers while performing the import process.
-
Drop the triggers before the import process, and then recreate them.
-
Use appropriate arguments while performing the import process to disable the firing of triggers.
-
Do nothing because the triggers will not be fired when you perform an import by using the bcp utility.
D
Correct answer
Explanation
The bcp (bulk copy program) utility in SQL Server bypasses triggers by default for performance. During bulk import operations, triggers are not fired unless specifically configured otherwise.
-
Structured Query Language
-
Sequential Query Language
-
Standard Query Language
-
Simple Query Language
A
Correct answer
Explanation
SQL is an industry-standard language designed for managing and manipulating relational databases. The name literally describes its purpose: a structured language for querying data.
-
INSERT
-
CREATE
-
UPDATE
-
COMMIT
B
Correct answer
Explanation
DDL (Data Definition Language) defines database structures. CREATE builds objects like tables, views, and indexes. INSERT and UPDATE are DML (data manipulation), while COMMIT is TCL (transaction control).
-
locate records quickly
-
locate a table quickly
-
to create a back up table
-
none of these
A
Correct answer
Explanation
Indexes create data structures that allow the database engine to find specific rows quickly without scanning entire tables. They optimize record retrieval based on column values.
-
ZERO
-
BLANK
-
NULL
-
NONE OF THESE
C
Correct answer
Explanation
In SQL databases, a column with no value stores NULL, which represents missing or unknown data. NULL is different from zero, a blank string, or an empty value - it is the absence of a value.
-
NEW
-
INSERT
-
ADD
-
NONE OF THESE
B
Correct answer
Explanation
INSERT is the standard SQL command for adding new records (rows) to a table. It specifies which table to modify and provides values for the columns.
-
MODIFY
-
CHANGE
-
UPDATE
-
EDIT
C
Correct answer
Explanation
UPDATE modifies existing data in a database. It changes values in specified columns for rows that match the WHERE condition, allowing targeted changes to existing records.
A
Correct answer
Explanation
DROP completely removes a table and its structure from the database, including all data, indexes, and constraints. DELETE removes only the data rows while preserving the table structure.
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.