Sql Practice Questions

SQL Practice Questions: Test Your Knowledge!

 

 

What is the purpose of the GROUP BY clause in SQL?
To join tables
To filter rows
To sort results
To group rows with similar values
Which SQL function is used to round a number to a specified number of decimal places?
CEIL()
FLOOR()
ROUND()
TRUNCATE()
What is the difference between DELETE and TRUNCATE in SQL?
DELETE removes specific rows, TRUNCATE removes all rows
DELETE is faster, TRUNCATE is slower
TRUNCATE can be rolled back, DELETE cannot
There is no difference
Which SQL function returns the number of rows affected by an INSERT, UPDATE, or DELETE statement?
ROW_COUNT()
AFFECTED_ROWS()
CHANGED_ROWS()
MODIFIED_ROWS()
Which SQL keyword is used to specify a common table expression (CTE)?
WITH
AS
USING
FROM
Which SQL function returns the smallest value in a set of values?
MIN
SMALLEST
LEAST
MINIMUM
What is the purpose of the SQL WINDOW function?
To define a named window specification for reuse in multiple window functions
To filter rows based on a condition
To sort the result set in ascending or descending order
To join tables based on a common column
Which SQL keyword is used to filter rows based on a condition?
SELECT
WHERE
FILTER
SEARCH
Which SQL function is used to calculate the sample standard deviation of a numeric column?
STDEV
STDDEV_SAMP
VARIANCE
DEVIATION
Which SQL statement is used to create a new index on a table?
CREATE INDEX
ALTER INDEX
INSERT INDEX
UPDATE INDEX
What is the purpose of the SQL CONCAT function?
To concatenate two or more strings together
To check if an expression is NULL
To return the first non-null value in a list of expressions
To replace NULL values with a specified value
What is the purpose of data aggregation in the ETL process?
To combine data from multiple sources
To summarize data at a higher level
To filter data based on specific criteria
To sort data in a specific order
Which SQL function is used to extract a substring from a string?
EXTRACT()
CUT()
SUBSTRING()
SLICE()
Which SQL statement is used to create a trigger?
CREATE TRIGGER
MAKE TRIGGER
BUILD TRIGGER
NEW TRIGGER
What is the purpose of the SQL PERCENT_RANK function?
To calculate the cumulative distribution of a value within a partition
To calculate the percentile rank of a value within a partition
To calculate the rank of a value within a partition
To calculate the dense rank of a value within a partition
Which SQL statement is used to create a new user-defined function?
CREATE FUNCTION
ALTER FUNCTION
DROP FUNCTION
NEW FUNCTION
What is the purpose of the SQL REGR_AVGY() function?
To calculate the average of the dependent variable in the linear regression between two numeric columns
To calculate the average of the independent variable in the linear regression between two numeric columns
To calculate the sum of squares of the independent variable in the linear regression between two numeric columns
To calculate the sum of squares of the dependent variable in the linear regression between two numeric columns
Which SQL function is used to perform window function calculations?
OVER
PARTITION BY
WINDOW
ANALYTICS
Which SQL function is used to calculate the variance of a set of values?
VAR
VARIANCE
VAR_POP
VAR_SAMP
Which SQL statement is used to insert new data into a database?
UPDATE
DELETE
SELECT
INSERT
Score: 0/20