0% found this document useful (0 votes)
11 views

Structured-Query-Language

The document consists of a series of questions and answers related to Structured Query Language (SQL), covering topics such as data retrieval, filtering, sorting, and table manipulation. Key SQL commands and functions are highlighted, including SELECT, INSERT, DELETE, and JOIN, along with their respective purposes and syntax. It serves as a quiz format to test knowledge on SQL concepts and operations.

Uploaded by

roberto bula
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Structured-Query-Language

The document consists of a series of questions and answers related to Structured Query Language (SQL), covering topics such as data retrieval, filtering, sorting, and table manipulation. Key SQL commands and functions are highlighted, including SELECT, INSERT, DELETE, and JOIN, along with their respective purposes and syntax. It serves as a quiz format to test knowledge on SQL concepts and operations.

Uploaded by

roberto bula
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 64

STRUCTURED

QUERY
LANGUAGE
EASY
1. Which of the following SQL
statements is used to retrieve data from
a database?
A) INSERT
B) UPDATE
C) SELECT
D) DELETE
C) SELECT
2. Which SQL clause is used to filter the
records returned by a SELECT query?
A) WHERE
B) GROUP BY
C) ORDER BY
D) HAVING
A) WHERE
3. Which SQL keyword is used to sort the
result set in ascending or descending
order?
A) GROUP BY
B) ORDER BY
C) SORT
D) FILTER
B) ORDER BY
4. What does the following SQL statement do: SELECT COUNT(*) FROM
employees;?
A) Returns the total number of columns in the 'employees' table
B) Returns the total number of rows in the 'employees' table
C) Returns the highest salary in the 'employees' table
D) Returns all employees from the table
B) RETURNS THE TOTAL
NUMBER OF ROWS IN THE
'EMPLOYEES' TABLE
 5. Which of the following SQL statements is used to
insert new records into a table?
 A) INSERT INTO
B) INSERT DATA
C) ADD RECORD
D) INSERT VALUES
A) INSERT INTO
6. Which SQL statement is used to
delete data from a table?
A) DELETE
B) REMOVE
C) DROP
D) TRUNCATE
A) DELETE
7. Which of the following operators is
used to match a pattern in a column?
A) =
B) LIKE
C) IN
D) BETWEEN
B) LIKE
8. What is the correct syntax for
updating data in a table?
A) UPDATE table_name SET column1 =
value1, column2 = value2 WHERE condition;
B) UPDATE table_name ADD column1 =
value1, column2 = value2 WHERE condition;
C) MODIFY table_name SET column1 =
value1, column2 = value2;
D) CHANGE table_name SET column1 =
value1 WHERE condition;
A) UPDATE TABLE_NAME SET COLUMN1
= VALUE1, COLUMN2 = VALUE2 WHERE
CONDITION;
9. Which SQL function is used to return
the average value of a column?
A) SUM()
B) COUNT()
C) AVG()
D) MAX()
C) AVG()
10. Which keyword is used to combine
the results of two or more SELECT
queries?
A) JOIN
B) COMBINE
C) UNION
D) CONCATENATE
C) UNION
AVERAGE
1. What is the result of the SQL statement
SELECT DISTINCT column_name FROM
table_name;?
A) Returns all rows from the table
B) Returns only the unique values in the specified
column
C) Returns the first row in the table
D) Returns the total count of rows
B) RETURNS ONLY THE
UNIQUE VALUES IN THE
SPECIFIED COLUMN
2. Which of the following constraints is
used to ensure that a value in a column
is unique across the table?
A) UNIQUE
B) NOT NULL
C) PRIMARY KEY
D) FOREIGN KEY
A) UNIQUE
3. Which SQL clause is used to group
rows that have the same values into
summary rows?
A) WHERE
B) HAVING
C) GROUP BY
D) ORDER BY
C) GROUP BY
4. What is the default sorting order of the ORDER
BY clause?
A) Ascending
B) Descending
C) Random
D) Not sorted
A) ASCENDING
5. What is the purpose of the JOIN clause in
SQL?
A) To filter rows based on a condition
B) To combine rows from two or more tables
C) To delete data from multiple tables
D) To insert data into multiple tables
B) TO COMBINE ROWS
FROM TWO OR MORE
TABLES
6. Which type of JOIN returns all rows
from both tables, with matching rows
from both sides when available?
A) LEFT JOIN
B) RIGHT JOIN
C) INNER JOIN
D) FULL OUTER JOIN
D) FULL OUTER JOIN
7. Which of the following SQL commands
is used to remove a table from a
database?
A) DELETE
B) REMOVE
C) DROP
D) TRUNCATE
C) DROP
8. Which function in SQL is used to find
the maximum value in a column?
A) MAX()
B) MIN()
C) SUM()
D) AVG()
A) MAX()
9. What is the purpose of the IN operator in
SQL?
A) To check if a value exists within a range of values
B) To find rows where a column is not NULL
C) To check if a value matches any value in a list or
subquery
D) To find values greater than a certain value
C) TO CHECK IF A VALUE
MATCHES ANY VALUE IN A
LIST OR SUBQUERY
10. What is the purpose of the BETWEEN
operator in SQL?
A) To match any of two values
B) To select values within a specified range
C) To select records based on exact matches
D) To find values within a list
B) TO SELECT VALUES
WITHIN A SPECIFIED RANGE
HARD
1. Which of the following SQL commands
is used to change the structure of an
existing table?
A) MODIFY
B) ALTER
C) UPDATE
D) CHANGE
B) ALTER
2. Which SQL keyword is used to prevent
duplicate rows in a SELECT query result?
A) UNIQUE
B) DISTINCT
C) FILTER
D) EXCLUDE
B) DISTINCT
3. Which of the following is true about the
HAVING clause in SQL?
A) It is used to filter rows before any grouping is done
B) It is used to filter rows after grouping is done
C) It cannot be used with aggregate functions
D) It is used to sort data
B) IT IS USED TO FILTER
ROWS AFTER GROUPING IS
DONE
4. Which SQL keyword is used to remove
duplicate records from a result set?
A) DELETE
B) REMOVE
C) DISTINCT
D) CLEAR
C) DISTINCT
5. In SQL, which of the following types of
keys is used to uniquely identify records
in a table?
A) Foreign Key
B) Primary Key
C) Candidate Key
D) Super Key
B) PRIMARY KEY
6. Which of the following is the correct
syntax to create a table in SQL?
A) CREATE TABLE table_name;
B) CREATE table_name;
C) CREATE TABLE table_name (column1
datatype, column2 datatype, ...);
D) CREATE TABLE (table_name column1
datatype, column2 datatype, ...);
C) CREATE TABLE
TABLE_NAME (COLUMN1
DATATYPE, COLUMN2
DATATYPE, ...);
7. What is the purpose of a FOREIGN KEY in
SQL?
A) To create a relationship between two tables
B) To create a unique constraint on a column
C) To automatically generate unique values in a
column
D) To index a column
A) TO CREATE A
RELATIONSHIP BETWEEN
TWO TABLES
8. Which SQL function is used to find the
total sum of a numeric column?
A) COUNT()
B) SUM()
C) MAX()
D) AVG()
B) SUM()
9. What does the SQL statement SELECT *
FROM employees WHERE salary BETWEEN
50000 AND 70000; do?
A) Returns all employees with salaries between
$50,000 and $70,000
B) Returns all employees with a salary greater than
$50,000
C) Returns all employees whose salary is less than
$70,000
D) Returns all employees with a salary equal to
$50000 and $70000
A) RETURNS ALL
EMPLOYEES WITH SALARIES
BETWEEN $50,000 AND
$70,000
30. Which SQL clause is used to set a condition
for an aggregate function like COUNT, SUM, or
AVG?
A) WHERE
B) HAVING
C) GROUP BY
D) ORDER BY
B) HAVING

You might also like