General SQL XIII
1.
Which SQL function is used to round a numeric value to the nearest integer?
ROUND()
CEIL()
FLOOR()
INT()
2.
Which SQL statement is used to grant SELECT permission on a table to a user?
GRANT SELECT TO user_name ON table_name;
ALLOW SELECT ON table_name FOR user_name;
GRANT PERMISSION SELECT ON table_name FOR user_name;
GRANT SELECT ON table_name TO user_name;
3.
Which SQL statement is used to remove a column from an existing table?
REMOVE COLUMN column_name FROM table_name;
ALTER TABLE table_name DROP COLUMN column_name;
DELETE COLUMN column_name FROM table_name;
DROP COLUMN column_name FROM table_name;
4.
Which SQL statement is used to revoke INSERT permission on a table from a user?
REVOKE INSERT TO user_name ON table_name;
DENY INSERT ON table_name TO user_name;
REVOKE PERMISSION INSERT ON table_name FOR user_name;
REVOKE INSERT ON table_name FROM user_name;
5.
Which SQL function is used to find the minimum value in a set of values?
MINIMUM()
SMALLEST()
LEAST()
MIN()
6.
Which SQL function is used to get the current date and time?
CURRENT_DATE_TIME()
NOW()
GET_DATE_TIME()
DATE_TIME_NOW()
7.
What is the purpose of the SQL keyword 'IS NULL' in a WHERE clause?
Groups the result set based on a column
Orders the result set in ascending or descending order
Performs arithmetic operations on the result set
Filters rows where the specified column is null
8.
Which SQL statement is used to create a new database?
MAKE DATABASE database_name;
NEW DATABASE database_name;
ADD DATABASE database_name;
CREATE DATABASE database_name;
9.
What does the SQL statement 'SELECT DISTINCT column_name FROM table_name;' do?
Updates all rows in the table
Counts the total number of rows in the table
Deletes all rows from the table
Retrieves unique values from the specified column in the table
10.
What is the purpose of the SQL keyword 'LIKE' in a WHERE clause?
Performs arithmetic operations on the result set
Orders the result set in ascending or descending order
Performs pattern matching in a WHERE clause
Filters rows based on a condition
11.
Which SQL statement is used to add a new column to an existing table?
ADD COLUMN new_column TO table_name;
ALTER TABLE table_name ADD COLUMN new_column data_type;
CREATE COLUMN new_column IN table_name;
MODIFY TABLE table_name ADD new_column data_type;
12.
What does the term 'Normalization' refer to in the context of databases?
Sorting data in ascending or descending order
Organizing data to minimize redundancy and dependency
Filtering data based on a condition
Grouping data based on a column
13.
What is the purpose of the SQL function 'SUBSTRING' in a SELECT statement?
Extracts a substring from a string
Combines multiple strings into one
Calculates the length of a string
Converts a string to uppercase
14.
In SQL, what does the term 'Cross Join' mean?
Generates the Cartesian product of two tables
A type of JOIN that retrieves unmatched rows from both tables
A method of searching for data by directly accessing the data pages
A method of sorting the result set
15.
What is the purpose of the SQL keyword 'UNION' in a SELECT statement?
Filters rows based on a condition after the GROUP BY clause
Orders the result set in ascending or descending order
Performs arithmetic operations on the result set
Combines the result sets of two or more SELECT statements, including duplicates
16.
What does the SQL statement 'SELECT AVG(salary) FROM employees WHERE department = 'IT';' do?
Updates all rows in the 'IT' department in the employees table
Counts the total number of employees in the 'IT' department
Deletes all rows from the 'IT' department in the employees table
Calculates the average salary of employees in the 'IT' department
17.
Which SQL function is used to convert a string to a date?
CAST_TO_DATE()
CONVERT_DATE()
TO_DATE()
PARSE_DATE()
18.
Which SQL statement is used to update a table based on values from another table?
UPDATE table1 SET column1 = table2.column2 WHERE table1.id = table2.id;
MODIFY table1 UPDATE column1 = table2.column2 WHERE table1.id = table2.id;
CHANGE table1 SET column1 = table2.column2 ON CONDITION table1.id = table2.id;
UPDATE table1 FROM table2 SET column1 = table2.column2 WHERE table1.id = table2.id;
19.
What is the purpose of the SQL keyword 'WITH CHECK OPTION' in a view?
Filters rows based on a condition after the GROUP BY clause
Orders the result set in ascending or descending order
Performs arithmetic operations on the result set
Ensures that all data modifications comply with the view definition
20.
What does the SQL statement 'SELECT AVG(quantity) FROM orders WHERE product_id = 1;' do?
Deletes all rows for a specific product in the orders table
Counts the total number of orders for a specific product
Calculates the average quantity of orders for a specific product
Updates all rows for a specific product in the orders table