Sql Practice Questions

SQL Practice Questions: Test Your Knowledge!

 

 

What is the purpose of the SQL DROP TABLE statement?
To delete an existing table
To add new rows to an existing table
To modify the structure of an existing table
To create a new table
What is the purpose of the SQL ORDER BY clause?
To sort the rows in a result set in ascending or descending order
To filter the rows in a result set based on a condition
To group the rows in a result set
To perform aggregate functions on a result set
What is the purpose of the INNER JOIN in SQL?
To return all rows from both tables, regardless of matching conditions
To return only the rows that have matching values in both tables
To return all rows from the left table and matching rows from the right table
To return all rows from the right table and matching rows from the left table
Which SQL function returns the current user of the database?
CURRENTUSER()
USER()
SYSUSER()
LOGGEDIN()
Which SQL function is used to calculate the average value of a column?
AVG
AVERAGE
MEAN
MEDIAN
What is the purpose of the SQL ORDER BY clause?
To order the results of a query
To filter rows based on a condition
To group rows that have the same values into summary rows
To limit the number of rows returned by a query
What is the purpose of the SQL HAVING clause?
To filter the rows in a result set based on a condition
To group the rows in a result set
To sort the rows in a result set
To perform aggregate functions on a result set
Which SQL function returns the name of the month from a date value?
MONTH()
MONTHNAME()
GETMONTH()
DATE_MONTH()
Which SQL statement is used to create a view?
MAKE VIEW
GENERATE VIEW
CREATE VIEW
NEW VIEW
What is the purpose of the SQL DATEPART function?
To extract a specific date or time component from a datetime value
To format a date
To calculate the difference between two dates
To perform date arithmetic
What is the purpose of the OFFSET FETCH clause in SQL?
To filter rows
To sort results
To skip a specified number of rows
To limit the result set
Which SQL function is used to calculate the number of weekdays between two dates during the transformation phase?
NETWORKDAYS
WORKDAYS
WEEKDAYS
BUSINESSDAYS
What is the purpose of the SQL DISTINCT keyword?
To return unique values from a column
To filter rows based on a condition
To order the results of a query
To limit the number of rows returned by a query
Which SQL function converts a number to a string?
TOSTRING()
STR()
CAST()
CONVERT()
Which SQL statement is used to grant permissions to a user?
ALLOW
PERMIT
GRANT
AUTHORIZE
Which SQL aggregate function is used to find the highest value in a column?
TOP
PEAK
MAX
CEILING
Which SQL keyword is used to perform a natural join between two tables?
NATURAL JOIN
IMPLICIT JOIN
DIRECT JOIN
INHERENT JOIN
What is the purpose of the SQL FULL OUTER JOIN clause?
To return rows when there is a match in either the left or right table
To return all rows from the left table, even if there are no matches in the right table
To return all rows from the right table, even if there are no matches in the left table
To return rows when there is a match in both tables
Which SQL operator is used to compare a value against a pattern using wildcard characters?
LIKE
MATCH
REGEX
CONTAINS
What is the purpose of the SQL DROP TABLE statement?
To delete a table and its data from the database
To empty a table without deleting its structure
To rename a table
To modify the structure of a table
Score: 0/20