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

Multiple choice
  1. CREATE INTO

  2. SELECT INTO

  3. CREATE FROM

  4. NONE OF THESE

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. is used with the DISTINCT SQL keyword only

  2. is used with the INSERT SQL keyword only

  3. determines if a value matches any of the values in a list or a sub-query

  4. defines the tables we are selecting or deleting data from

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. update only one row at a time

  2. update more than one row at a time

  3. delete more than one row at a time

  4. delete only one row at a time

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. Disable the triggers while performing the import process.

  2. Drop the triggers before the import process, and then recreate them.

  3. Use appropriate arguments while performing the import process to disable the firing of triggers.

  4. Do nothing because the triggers will not be fired when you perform an import by using the bcp utility.

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. Structured Query Language

  2. Sequential Query Language

  3. Standard Query Language

  4. Simple Query Language

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. INSERT

  2. CREATE

  3. UPDATE

  4. COMMIT

Reveal answer Fill a bubble to check yourself
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).

Multiple choice
  1. locate records quickly

  2. locate a table quickly

  3. to create a back up table

  4. none of these

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. ZERO

  2. BLANK

  3. NULL

  4. NONE OF THESE

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. MODIFY

  2. CHANGE

  3. UPDATE

  4. EDIT

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. DROP

  2. ERASE

  3. DELETE

  4. REMOVE

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. GET

  2. EXTRACT

  3. SELECT

  4. VIEW

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. It is used to add an integrity constraint to a table.

  2. It is used to redefine a column of the table.

  3. It is used to change a table's storage characterstics.

  4. It is used to create tables and definine columns.

  5. It enables or disables integrity constraints.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

This option is correct as CREATE TABLE command creates a table in the database.