General SQL V
1.
What is the purpose of the SQL keyword 'DISTINCTROW'?
To retrieve unique values in a specified column
To eliminate duplicate rows based on all columns in the SELECT statement
To filter rows based on a condition after the GROUP BY clause
To group rows based on a specified column
2.
Which SQL statement is used to rename a table?
RENAME TABLE old_table TO new_table;
ALTER TABLE old_table RENAME TO new_table;
CHANGE TABLE old_table RENAME new_table;
MODIFY TABLE old_table RENAME new_table;
3.
What does the term 'OLAP' stand for in the context of databases?
Online Automated Processing
Online Analytical Processing
Optimized Logical Analysis Process
Organized Logical Array Processing
4.
Which SQL clause is used to filter the result set by applying conditions on aggregated data?
GROUP BY
WHERE
HAVING
FILTER
5.
In SQL, what is the purpose of the SAVEPOINT statement?
Creates a point within a transaction to which you can later roll back
Saves the result of a query into a new table
Saves the entire transaction to be committed later
Commits the current transaction and releases all locks
6.
Which SQL data type is used to store a date and time combination?
DATETIME
TIMESTAMP
DATE
TIME
7.
What is the purpose of the SQL keyword 'ROLLBACK'?
Rolls back to the previous state in a transaction
Commits the current transaction and releases all locks
Saves the entire transaction to be committed later
Undoes all changes made in the current transaction
8.
Which SQL function is used to find the position of a substring within a string?
INSTR()
POSITION()
SUBSTRING_INDEX()
LOCATE()
9.
What does the SQL statement 'SELECT AVG(salary) FROM employees WHERE department = 'IT';' do?
Retrieves the salary of the employee with the highest salary in the IT department
Counts the total number of employees in the IT department
Calculates the average salary of employees in the IT department
Finds the sum of the salaries of all employees in the IT department
10.
In SQL, what is the purpose of the CURSOR?
A constraint that ensures data integrity
A temporary table that holds the result of a query
A pointer used for sequential processing of rows returned by a query
A function that performs a calculation on a set of values
11.
What is the purpose of the SQL keyword 'CASE' in a SELECT statement?
Groups rows based on a specified column
Performs conditional logic in the SELECT statement
Orders the result set
Filters rows based on a condition
12.
Which SQL statement is used to delete a column from a table?
ALTER TABLE table_name DROP COLUMN column_name;
DELETE COLUMN column_name FROM table_name;
REMOVE COLUMN column_name FROM table_name;
DROP COLUMN column_name FROM table_name;
13.
What is the purpose of the SQL keyword 'CROSS APPLY'?
Applies a table-valued function to each row and returns the result set
Combines rows from two or more tables based on a related column
Filters rows based on a condition after the GROUP BY clause
Orders the result set in ascending or descending order
14.
Which SQL function is used to find the total number of characters in a string?
LENGTH()
CHAR_LENGTH()
LEN()
SIZE()
15.
What is the purpose of the SQL keyword 'UNION ALL' in a SELECT statement?
Combines the result sets of two or more SELECT statements, excluding duplicates
Combines the result sets of two or more SELECT statements, including duplicates
Filters the result set based on a condition after the GROUP BY clause
Orders the result set in ascending or descending order
16.
Which SQL statement is used to change the data type of a column in a table?
ALTER TABLE table_name CHANGE COLUMN column_name new_data_type;
CHANGE COLUMN column_name TO new_data_type IN table_name;
MODIFY COLUMN column_name TO new_data_type IN table_name;
ALTER TABLE table_name MODIFY COLUMN column_name new_data_type;
17.
In SQL, what does the term 'Query Optimization' refer to?
The process of combining rows from two or more tables based on a related column
The process of creating a query to retrieve specific data from a database
The process of organizing data in a database to reduce redundancy
The process of improving the performance of a query by choosing the most efficient execution plan
18.
What is the purpose of the SQL keyword 'TRANSACTION ISOLATION LEVEL'?
Specifies the isolation level for a transaction, determining the degree of visibility for changes made by other transactions
Specifies the transaction to be committed
Specifies the order of the result set
Performs arithmetic operations on the result set
19.
Which SQL function is used to find the maximum value in a column?
MIN()
MAX()
SUM()
AVG()
20.
What is the purpose of the SQL keyword 'NATURAL JOIN'?
Combines rows from two or more tables based on a related column
Automatically joins tables based on columns with the same name
Filters rows based on a condition after the GROUP BY clause
Orders the result set in ascending or descending order