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 → SQL Basics 5

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 → Introduction to DBMS 26

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
SAVEPOINT creates
Named marker within transaction for partial rollback
click to copy
UNIQUE constraint prevents
Duplicate non-NULL values in a column
click to copy
CHECK constraint ensures
Column values satisfy a boolean expression
click to copy
ON DELETE CASCADE
Automatically deletes child rows when parent row deleted
click to copy
COALESCE(NULL,NULL,5,10) returns
5
click to copy
NULLIF(5,5) returns
NULL
click to copy
% in SQL LIKE matches
Zero or more characters
click to copy
BETWEEN a AND b is
Inclusive on both ends (a ≤ value ≤ b)
click to copy
WHERE col IN (1,2,3) equals
col=1 OR col=2 OR col=3
click to copy
CASE expression provides
Conditional IF-THEN-ELSE logic within SQL query
click to copy
X→Y (X functionally determines Y) means
For each X value there is exactly one corresponding Y value
click to copy

DBMS → Joins 3

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 → 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 2

COMMIT permanently
Saves all transaction changes to database
click to copy
ROLLBACK
Undoes changes since last COMMIT or SAVEPOINT
click to copy

DBMS → Normalization 2

Normalization is which database design approach?
Bottom-up
click to copy
1NF requires
All attributes atomic and no repeating groups
click to copy