Quick Revision

GK One-Line Question & Answer

15541+ short questions with short answers, covering every category and sub-category on the site — no long articles to scroll through. Good for a fast recap before an exam, or a few minutes of daily practice.

DBMS → Introduction to DBMS 24

R−S returns
Tuples in R that do NOT exist in S
click to copy
Cartesian product R×S produces
All possible combinations of tuples from R and S
click to copy
Renaming operator in relational algebra is
ρ
click to copy
Division R÷S is useful for
Universal quantification queries (for all/every conditions)
click to copy
Five basic RA operators are
σ,π,∪,−,× (selection,projection,union,difference,cross-product)
click to copy
If |R|=5 rows and |S|=4 rows, R×S has
20 rows
click to copy
R∩S expressed using basic operators equals
R−(R−S)
click to copy
SQL stands for
Structured Query Language
click to copy
SELECT retrieves
Data from one or more tables
click to copy
SELECT DISTINCT removes
Duplicate rows from result set
click to copy
COUNT(*) counts
ALL rows including those with NULLs
click to copy
EXISTS subquery returns TRUE when
Subquery returns at least one row
click to copy
UNION combines results and by default
Removes duplicate rows
click to copy
UNION ALL keeps
ALL rows including duplicates
click to copy
MAX() returns
Highest value
click to copy
SUM() returns
Total sum of numeric values
click to copy
AVG() returns
Average (arithmetic mean) of values
click to copy
A scalar subquery returns
Exactly one row and one column (single value)
click to copy
WITH clause (CTE) creates
Named temporary result set valid within one SQL statement
click to copy
ROW_NUMBER() assigns
Unique sequential integer to each row
click to copy
RANK() gives 1,2,2,4 for ties because
Skips rank numbers AFTER ties (gap after tied ranks)
click to copy
DENSE_RANK() gives 1,2,2,3 for ties because
It never skips rank numbers after ties
click to copy
GRANT command gives
Specific privileges to a user on a database object
click to copy
REVOKE command
Removes privileges
click to copy

DBMS → Joins 7

Theta join R⊲⊳θS equals
σθ(R×S)
click to copy
Equijoin uses which condition operator
= (equality)
click to copy
Natural join joins on
All attributes with same name in both relations
click to copy
Anti-join R▷S returns
Tuples in R that have NO matching tuple in S
click to copy
INNER JOIN returns
Only rows where join condition satisfied in BOTH tables
click to copy
LEFT JOIN returns
All left table rows plus matching right rows (NULLs for no match)
click to copy
FULL OUTER JOIN returns
All rows from both; NULLs for non-matches
click to copy

DBMS → SQL Basics 6

WHERE clause filters
Individual rows BEFORE grouping based on condition
click to copy
HAVING clause filters
Groups AFTER GROUP BY aggregation
click to copy
ORDER BY clause
Sorts result set in ASC (default) or DESC order
click to copy
GROUP BY groups rows that
Share same values in specified columns
click to copy
LAG(salary,1) OVER(ORDER BY date) returns
Previous row salary value in ordered partition
click to copy
LEAD(salary,1) OVER(ORDER BY date) returns
Next row salary value in ordered partition
click to copy

DBMS → Views 1

A view in SQL is
Virtual table defined by a SELECT query
click to copy

DBMS → PL/SQL 1

A trigger automatically executes when
Specified DML event occurs on a table
click to copy

DBMS → Transactions 1

COMMIT permanently
Saves all transaction changes to database
click to copy