11.) What is the purpose of the EXISTS clause in SQL?
A) To check if a table exists
B) To optimize queries
C) To create a temporary table
D) To verify the presence of rows in a subquery
12.) Which of the following best describes a self-join?
A) A join between two different tables
B) A join that excludes null values
C) A join of a table with itself
D) A join that merges columns
13.) What is the primary use of a FULL OUTER JOIN?
A) Combines rows with matching values only
B) Includes all rows from both tables, matching where possible
C) Joins rows based on primary keys
D) Joins rows with null values only
14.) How does the LAG() function work in SQL?
A) Returns the previous value in a set
B) Returns the next value in a set
C) Computes a running total
D) Returns the average value of a set
15.) What is the purpose of the ROW_NUMBER() function?
A) Assigns unique numbers to rows within a partition
B) Calculates the total number of rows in a table
C) Assigns ranks with gaps for duplicates
D) Creates a unique index
16.) Which SQL keyword is used to combine results from multiple queries?
A) JOIN
B) UNION
C) INTERSECT
D) EXCEPT
17.) What is the difference between DELETE and TRUNCATE?
A) DELETE removes all rows; TRUNCATE removes specific rows
B) DELETE is faster than TRUNCATE
C) DELETE resets indexes; TRUNCATE does not
D) DELETE removes specific rows; TRUNCATE removes all rows
18.) What is a materialized view?
A) A dynamically updated query result
B) A schema for table design
C) A temporary table for joins
D) A stored query result that is periodically updated
19.) What is a scalar subquery?
A) A subquery that returns a single value
B) A subquery that returns multiple rows
C) A subquery used in joins
D) A subquery that updates data
20.) How does PARTITION BY enhance window functions?
A) Joins rows with matching values
B) Aggregates data within a table
C) Divides data into subsets for analysis
D) Eliminates null values
Related