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 → PL/SQL 3

What is the difference between static SQL and dynamic SQL in PL/SQL and when is each preferred?
Static SQL: SQL statements written directly in PL/SQL code at compile time (SELECT col INTO var FROM t WHERE id=x); validated and optimized at compile time gives better performance and error detection. Dynamic SQL (EXECUTE IMMEDIATE NDS): SQL constructed as strings at runtime; necessary when table/column names or statement type are not known until runtime but has higher overhead and risk of SQL injection if not using bind variables
click to copy
What is the FORALL statement and how does it differ from a regular FOR loop for DML operations?
FORALL sends the entire collection of DML operations to the SQL engine in a single context switch (one round-trip) vs. a regular FOR loop which sends each DML operation individually (one round-trip per iteration); FORALL is typically 10-100x faster for bulk DML because it eliminates N-1 context switches for N rows
click to copy
What is a PL/SQL record type and how does it differ from a collection?
A PL/SQL record type is a composite data type that groups related fields of different data types into a single structure (similar to a struct in C or row in a table); a collection is an ordered set of elements all of the same type. Records group heterogeneous fields; collections group homogeneous elements
click to copy

DBMS → Introduction to DBMS 7

What is the difference between DBMS and a file system at the concurrency level?
DBMS provides built-in concurrency control ensuring consistent simultaneous multi-user access; file systems provide no such mechanism leading to race conditions and data corruption under concurrent access
click to copy
What is the ER-to-relational mapping step in database design methodology?
The process of transforming a conceptual ER model into a concrete relational schema following systematic rules for entities, relationships, and attributes
click to copy
What is the three-tier architecture in the context of DBMS application development?
An architectural pattern separating applications into presentation tier (UI), application/logic tier (business rules), and data tier (DBMS); enables independent scaling, better security, and technology flexibility per tier
click to copy
What is database replication and what are the primary use cases?
The process of copying and maintaining database objects in multiple databases simultaneously; primary use cases: high availability (failover replica), read scalability (read replicas), geographic distribution, backup, and analytics reporting on replica
click to copy
What is a database cluster and how does it differ from a single database instance?
A group of database servers working together to provide higher availability, scalability, and fault tolerance than a single instance; includes shared-nothing clusters (sharding), shared-disk clusters (Oracle RAC), and active-passive failover clusters
click to copy
What is the concept of database abstraction layers (DAL) in application development?
A software layer between the application code and the database that abstracts specific database implementation details allowing the application to work with multiple database systems or switch databases without major code changes; examples include ORM frameworks and database adapter libraries
click to copy
What is data migration in the context of DBMS and what are the key challenges?
The process of transferring data between storage types, formats, or systems while ensuring data integrity, consistency, and completeness; key challenges include schema mapping differences, data type incompatibilities, referential integrity violations, handling NULL values, and performance for large datasets
click to copy

DBMS → Database Architecture 7

What is the difference between hot standby and warm standby in database high availability?
Hot standby: a replica that is continuously synchronized and can accept connections immediately on failover (seconds); warm standby: synchronized but not fully ready until activated (minutes); cold standby: requires restoration from backup (hours)
click to copy
What is database connection pooling and what problems does it solve?
A technique that maintains a pool of pre-established database connections that can be reused by application threads, avoiding the expensive cost of creating and destroying a new connection for each request; solves connection overhead, connection limits, and connection storms under high load
click to copy
What is read-write splitting in database architecture and what are the consistency trade-offs?
A pattern where write operations go to the primary database and read operations go to one or more replica databases; trade-off: replicas may lag behind primary so reads may return slightly stale data - applications must decide which reads require strong consistency versus which can tolerate stale data
click to copy
What is a database proxy and what functions does it serve in a database architecture?
A middleware component that sits between the application and the database server providing connection pooling, query routing (read-write splitting), load balancing, query caching, query filtering/firewall, and transparent failover without application changes
click to copy
What is the active-active database cluster and what challenges does it present?
A cluster where multiple nodes simultaneously accept read and write operations; challenges include write-write conflicts (two nodes update same row simultaneously), conflict resolution strategies, increased network overhead for synchronization, and consistency vs availability trade-offs
click to copy
What is HTAP (Hybrid Transactional/Analytical Processing) database architecture?
An architecture that combines OLTP and OLAP workloads in the same database system, eliminating the need for separate data warehouse ETL pipelines; achieves this through in-memory row store for OLTP plus columnar store for OLAP, or real-time replication from row store to column store
click to copy
What is database sharding and what is the difference between range sharding and hash sharding?
Sharding horizontally distributes data across multiple database servers; range sharding: assigns rows based on key value ranges enabling efficient range queries but risking hot spots; hash sharding: distributes rows using hash(key) mod num_shards providing even distribution but preventing efficient range scans
click to copy

DBMS → Data Models 7

What is the object-relational impedance mismatch and how do ORMs address it?
The conceptual gap between object-oriented programming (inheritance, associations, identity, encapsulation) and relational databases (tables, foreign keys, joins, set-based operations); ORMs address this by providing mapping configurations that translate between object graphs and table rows
click to copy
What is the document embedding vs referencing decision in document data models?
In document databases: embedding stores related data as nested sub-documents within a parent document (denormalized, one read, no joins but large documents); referencing stores related data in separate collections with explicit references (normalized, requires multiple reads but smaller documents and shared data); the choice depends on access patterns and update frequency
click to copy
What is the columnar data model and how does Apache Parquet implement it?
A storage format where data for each column is stored contiguously rather than row-by-row; Apache Parquet implements this with row groups (horizontal partitions), column chunks (vertical partitions within a row group), nested encoding (Dremel levels for nested schemas), and column statistics enabling predicate pushdown
click to copy
What is the time-series data model and what specific optimizations make it different from a general-purpose relational model?
A data model optimized for append-only time-stamped measurements with automatic time-based partitioning, compressed columnar storage (delta encoding compresses well), downsampling of old data, and specialized time functions such as interpolation, moving averages, and gap filling
click to copy
What is the difference between schema-on-read and schema-on-write approaches in data modeling?
Schema-on-write (traditional RDBMS): schema is defined and enforced before data is written; data must conform to schema at write time (strict, consistent but less flexible). Schema-on-read (Hadoop/data lake): raw data is stored without enforcing schema; schema is applied when data is read (flexible, accepts any data format)
click to copy
What is the outbox pattern in data modeling for distributed systems?
A pattern that ensures atomicity between database writes and message/event publishing: write the event to an outbox table in the same DB transaction as the business data, then have a separate process reliably publish from the outbox, ensuring events are never lost even if the broker is temporarily unavailable
click to copy
What is the data vault modeling approach and when is it preferred over star schema?
A hybrid data modeling methodology for enterprise data warehouses that separates hubs (business keys), links (relationships between hubs), and satellites (descriptive attributes with history); preferred when requirements change frequently, full historical tracking is needed, or multiple source systems need to be integrated incrementally
click to copy

DBMS → ER Model 5

What is the difference between conceptual, logical, and physical ER models?
Conceptual ER: high-level diagram with entities and relationships only (no attributes or keys), technology-agnostic, used for stakeholder communication. Logical ER: adds attributes, primary/foreign keys, cardinality, normalization, still DBMS-agnostic. Physical ER: DBMS-specific implementation (actual table names, data types, indexes, constraints, partitioning)
click to copy
What is cardinality notation in ER diagrams and what are the main notational systems used?
Symbols in ER diagrams that specify how many instances of one entity can be associated with instances of another entity; main systems: Chen notation (1, N, M near relationship diamonds), Crow Foot notation (symbols on relationship lines used in most modern tools), UML class diagram notation (1, 0..1, *, 1..*), and IDEF1X notation
click to copy
What is entity subtyping and what are the three common implementation strategies in relational databases?
Entity subtyping (specialization/generalization) maps a supertype-subtype hierarchy to relational tables using: Single Table Inheritance (one table, nulls for subtype-specific columns), Table Per Type (supertype table plus subtype tables with FK to supertype), or Table Per Concrete Type (one table per concrete subtype with no joins but redundant common columns)
click to copy
What is the surrogate key vs natural key debate in ER/relational design?
Surrogate key (system-generated integer/UUID): stable (never changes even if business data changes), simple (single column joins), private (no business meaning exposed); Natural key (business identifier like SSN, ISBN): meaningful, already unique, no extra column needed but may change, may be complex, may expose sensitive data. Best practice: surrogate PK with unique constraint on natural key
click to copy
What is the concept of ontological commitment in ER modeling and how does it affect schema design?
The set of assumptions made about the nature and categories of entities in the domain; in ER design this means deciding what constitutes an entity vs an attribute vs a relationship - different ontological choices lead to fundamentally different schemas that are logically equivalent but have different query performance and flexibility trade-offs
click to copy

DBMS → Relational Model 4

What are Codds 12 rules and what is Rule 0 (the foundation rule)?
Codds 12 rules define what constitutes a truly relational DBMS; Rule 0 (Foundation Rule): a system that claims to be a relational database management system must be able to manage databases entirely through its relational capabilities - no special non-relational mechanisms should be required
click to copy
What is domain calculus in relational databases and how does it differ from tuple calculus?
Both are non-procedural query languages equivalent in power to relational algebra. Tuple relational calculus: variables range over tuples (rows). Domain relational calculus: variables range over individual attribute values (domains). Both are the theoretical foundation for SQL
click to copy
What is relational completeness and what does it mean for a query language?
A query language is relationally complete if it is at least as expressive as relational algebra; i.e., it can express any query that relational algebra can express. SQL is relationally complete (and more, with aggregate functions, recursion, etc.). A language that cannot express certain relational algebra operations is not relationally complete
click to copy
What is query containment in relational databases and why is it important for query optimization?
Query Q1 is contained in Q2 (Q1 <= Q2) if for every database instance D the result of Q1 on D is a subset of the result of Q2 on D; important for: query optimization (replace Q1 with cheaper equivalent Q2), semantic caching (if cached result of Q2 contains all results of Q1 use cache), and query rewriting using materialized views
click to copy

DBMS → Normalization 3

What is over-normalization and how can it harm database performance?
Normalizing beyond what is practically necessary, resulting in too many tables that require expensive JOIN operations for every query; symptoms include 5+ table joins for common queries, poor OLTP performance due to join overhead, complex application code to reconstruct objects, and negligible storage savings that do not justify the performance cost
click to copy
What is the difference between lossless join and dependency-preserving decomposition and why might you choose one over the other?
Lossless join: joining decomposed relations returns exactly the original relation (no spurious tuples) - mandatory for correctness. Dependency-preserving: all original FDs can be verified in decomposed relations without joins - desirable but not always achievable with BCNF. 3NF always achieves both but BCNF may sacrifice dependency preservation for stronger redundancy elimination
click to copy
What is normalization by synthesis vs normalization by decomposition?
Synthesis (3NF synthesis algorithm): constructs normalized relations from scratch using minimal cover of FDs; bottom-up approach that creates one relation per FD in canonical cover and ensures lossless plus dependency-preserving result. Decomposition (BCNF decomposition): starts with one large unnormalized relation and repeatedly splits it by finding violating FDs; top-down approach
click to copy

DBMS → SQL Basics 3

What is the SQL standard window frame specification and how does ROWS differ from RANGE?
Window frame defines the subset of rows within a partition considered for each calculation. ROWS: physical row offset (always a fixed number of rows). RANGE: logical value range (all rows within a specified value distance of current row's ORDER BY value, which may include many rows if duplicates exist)
click to copy
What is SQL grouping sets feature and how does it extend GROUP BY?
GROUPING SETS allows computing multiple GROUP BY aggregations in a single query pass; ROLLUP generates subtotals and grand total for a hierarchy; CUBE generates all possible combinations of group-by columns; more efficient than multiple UNION ALL queries because the data is scanned only once
click to copy
What is a lateral join or APPLY operator in SQL and what makes it different from a regular join?
LATERAL (PostgreSQL/SQL standard) or CROSS APPLY/OUTER APPLY (SQL Server): allows a subquery or table-valued function in the FROM clause to reference columns from preceding tables in the same FROM clause; a regular derived table subquery cannot reference outer columns - LATERAL enables correlated subqueries in the FROM clause
click to copy

DBMS → DDL Commands 1

What is a deferred constraint and when is it used in DDL?
A constraint declared with DEFERRABLE INITIALLY DEFERRED is checked at COMMIT time rather than after each statement; used for circular foreign key references, bulk loading where intermediate states temporarily violate constraints, and complex multi-step operations where the final committed state is valid
click to copy