๐ŸŒ SQL & Databases ยท subject

SQL & Databases Relational Database Fundamentals Syllabus

The Relational Database Fundamentals syllabus for SQL & Databases in full: 4 chapters and 16 topics, every one listed below, plus 51 Relational Database Fundamentals flashcards with answers.

4Chapters
16Topics
51Flashcards

Relational Database Fundamentals syllabus: all 4 chapters

Expand any chapter to see its topics and sub-topics.

  1. Database Concepts and Architecture

    4 topics
    • What Is a Database and a DBMS
    • Relational Model Foundations
    • Three-Schema Architecture
    • RDBMS Landscape
  2. Keys and Integrity Constraints

    4 topics
    • Primary and Candidate Keys
    • Foreign Keys and Referential Integrity
    • Constraint Types
    • Entity and Domain Integrity
  3. Data Types and Schema Definition

    4 topics
    • Numeric, Character, and Boolean Types
    • Date, Time, and Timestamp Types
    • Specialized Types
    • NULL Semantics and Three-Valued Logic
  4. SQL Sublanguages Overview

    4 topics
    • DDL: Define Schema Objects
    • DML: Manipulate Data
    • DQL: Query Data
    • DCL and TCL

SQL & Databases Relational Database Fundamentals flashcards โ€” 51 questions with answers

  1. What is a database?

    An organized, persistent collection of related data stored so it can be efficiently accessed, managed, and updated. It models some part of the real world (the miniworld/universe of discourse).

  2. What is a DBMS (Database Management System)?

    Software that lets users define, create, query, update, and administer databases. It sits between users/applications and the stored data, providing concurrency control, security, recovery, and integrity enforcement. Examples: PostgreSQL, MySQL, Oracle.

  3. Name four key services a DBMS provides beyond simple file storage.

    1) Data independence (logical/physical), 2) Concurrency control for multiple users, 3) Recovery from failures (durability), 4) Integrity and security enforcement. Also querying via a declarative language.

  4. Who proposed the relational model and when?

    E. F. (Ted) Codd of IBM proposed the relational model in 1970 in the paper 'A Relational Model of Data for Large Shared Data Banks.'

  5. In the relational model, what are the formal terms for table, row, and column?

    Table = relation; row = tuple; column = attribute. The number of attributes is the degree, and the number of tuples is the cardinality.

  6. What is a relation formally in terms of sets?

    A relation is a subset of the Cartesian product of the domains of its attributes: $R \subseteq D_1 \times D_2 \times \cdots \times D_n$. Each tuple is an element of that product, so a relation is a set of tuples.

  7. What is a domain in the relational model?

    A domain is the set of all atomic (indivisible) values that an attribute may take, together with a data type and format (e.g., the domain of ages might be integers $0 \leq \text{age} \leq 150$).

  8. What does the 'first normal form' / relational requirement of atomicity mean?

    Every attribute value must be atomic (single-valued and indivisible); relations cannot contain repeating groups, nested tables, or multivalued cells in the pure relational model.

  9. What is the significance of relations being sets with respect to row order and duplicates?

    Because a relation is a set of tuples: tuples have no inherent order, and no two tuples can be identical (no duplicate rows). Attribute order is also logically immaterial since attributes are named.

  10. What is the ANSI/SPARC three-schema architecture?

    A three-level model for data independence: 1) External (view) level โ€” individual user views; 2) Conceptual (logical) level โ€” the whole community's logical schema; 3) Internal (physical) level โ€” how data is physically stored.

  11. What is the difference between logical and physical data independence?

    Logical data independence: ability to change the conceptual schema without altering external views/applications. Physical data independence: ability to change the internal (physical storage) schema without altering the conceptual schema.

  12. Which mapping in the three-schema architecture supports logical data independence, and which supports physical?

    The external/conceptual mapping supports logical data independence; the conceptual/internal mapping supports physical data independence.

  13. What is an RDBMS?

    A Relational Database Management System โ€” a DBMS based on the relational model that stores data in tables and typically uses SQL as its query language, enforcing relational integrity constraints.

  14. Give examples of major RDBMS products, both open-source and commercial.

    Open-source: PostgreSQL, MySQL, MariaDB, SQLite. Commercial: Oracle Database, Microsoft SQL Server, IBM Db2. SQLite is notably an embedded, serverless RDBMS.

  15. What is a candidate key?

    A minimal set of attributes that uniquely identifies each tuple in a relation. 'Minimal' means no attribute can be removed without losing uniqueness. A relation may have several candidate keys.

  16. What is a primary key and how does it relate to candidate keys?

    The primary key is the one candidate key chosen by the designer to be the principal unique identifier of tuples. Its values must be unique and NOT NULL (entity integrity). The other candidate keys become alternate keys.

  17. What is a superkey, and how does it differ from a candidate key?

    A superkey is any set of attributes that uniquely identifies tuples (uniqueness only). A candidate key is a minimal superkey โ€” one with no removable attribute. Every candidate key is a superkey, but not vice versa.

  18. What is a composite (compound) key?

    A key consisting of two or more attributes combined to uniquely identify a tuple, used when no single attribute is unique on its own.

  19. What is a foreign key?

    An attribute (or set) in one relation whose values must match a primary key (or candidate key) value in another (or the same) relation, or be NULL. It establishes and enforces a link between the two tables.

  20. What is referential integrity?

    The rule that every non-NULL foreign key value must reference an existing tuple in the referenced relation. It prevents 'orphan' rows that point to nonexistent parent records.

Show the other 31 Relational Database Fundamentals flashcards
  1. What referential actions can be specified for ON DELETE / ON UPDATE of a foreign key?

    CASCADE (propagate the change), SET NULL (set FK to NULL), SET DEFAULT (set FK to its default), RESTRICT / NO ACTION (reject the operation if references exist).

  2. List the main types of constraints in a relational database.

    NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY (referential), CHECK (domain/value condition), and DEFAULT (supplies a value when none given). PRIMARY KEY = UNIQUE + NOT NULL.

  3. What is the difference between a UNIQUE constraint and a PRIMARY KEY constraint?

    Both enforce uniqueness, but a table may have many UNIQUE constraints and only one PRIMARY KEY. UNIQUE columns may allow NULLs (typically one or many depending on the DBMS), whereas a PRIMARY KEY forbids NULLs.

  4. What does a CHECK constraint do?

    It enforces a Boolean condition that every row must satisfy (e.g., CHECK (salary > 0)). Rows violating the predicate are rejected. It is used to enforce domain/business rules at the column or table level.

  5. Define entity integrity.

    The rule that no attribute of a primary key may be NULL. This guarantees each tuple is uniquely identifiable, since a NULL primary key value could not reliably distinguish rows.

  6. Define domain integrity.

    The requirement that every attribute value belongs to its declared domain โ€” the correct data type, format, and range โ€” typically enforced by data types, NOT NULL, CHECK, and DEFAULT constraints.

  7. What are the standard SQL exact-numeric and approximate-numeric types?

    Exact: INTEGER (and SMALLINT, BIGINT), NUMERIC/DECIMAL(p,s) with fixed precision $p$ and scale $s$. Approximate (floating-point): REAL, FLOAT, DOUBLE PRECISION, which store binary approximations.

  8. In DECIMAL(p, s), what do p and s mean?

    $p$ (precision) is the total number of significant digits; $s$ (scale) is the number of digits to the right of the decimal point. For example DECIMAL(7,2) stores values up to $\pm 99999.99$.

  9. Why should money be stored in DECIMAL/NUMERIC rather than FLOAT?

    Floating-point types store binary approximations and cannot represent many decimal fractions exactly (e.g., $0.1$), causing rounding errors. DECIMAL/NUMERIC is exact, which is required for financial calculations.

  10. What is the difference between CHAR(n) and VARCHAR(n)?

    CHAR(n) is fixed-length: values are right-padded with spaces to exactly $n$ characters. VARCHAR(n) is variable-length: it stores only the actual characters up to a maximum of $n$, using less space for short values.

  11. What type stores large character data, and how does the BOOLEAN type behave in SQL?

    TEXT / CLOB stores large/unbounded character data. BOOLEAN holds the logical values TRUE and FALSE โ€” and, because of SQL's three-valued logic, also UNKNOWN (represented by NULL).

  12. What are the standard SQL date/time types?

    DATE (calendar date), TIME (time of day), TIMESTAMP (date + time), and interval types (INTERVAL). Variants WITH TIME ZONE (TIMESTAMPTZ) store zone/offset information.

  13. What is the difference between TIMESTAMP WITHOUT TIME ZONE and TIMESTAMP WITH TIME ZONE?

    WITHOUT TIME ZONE stores the literal date/time with no zone context. WITH TIME ZONE (TIMESTAMPTZ) normalizes the value to UTC on storage and converts to the session's time zone on retrieval, making it unambiguous across zones.

  14. What is an INTERVAL type used for?

    An INTERVAL represents a span/duration of time (e.g., '2 days 3 hours') rather than a point in time. Intervals can be added to or subtracted from dates and timestamps.

  15. Name several specialized SQL data types beyond numbers, strings, and dates.

    BLOB/BYTEA (binary data), JSON/JSONB (semi-structured documents), XML, UUID (128-bit unique identifiers), ARRAY, ENUM, and spatial/GEOMETRY types. PostgreSQL notably supports many of these natively.

  16. What is the difference between JSON and JSONB in PostgreSQL?

    JSON stores an exact textual copy (preserving whitespace/key order, reparsed each access). JSONB stores a decomposed binary form: faster to process and indexable (GIN), but does not preserve key order or duplicate keys.

  17. What is a UUID and why is it used?

    A UUID (Universally Unique Identifier) is a 128-bit value, often shown as 32 hex digits in 5 groups (8-4-4-4-12). It provides globally unique keys generated without central coordination, useful for distributed systems.

  18. What does NULL represent in SQL?

    NULL is a marker for the absence of a value โ€” meaning 'unknown,' 'not applicable,' or 'missing.' It is NOT the same as zero, an empty string, or FALSE.

  19. What is three-valued logic (3VL) in SQL?

    SQL Boolean expressions can evaluate to TRUE, FALSE, or UNKNOWN. Any comparison involving NULL yields UNKNOWN, so predicates that are not definitely TRUE do not qualify rows in WHERE clauses.

  20. Why does 'column = NULL' never return rows, and what should be used instead?

    Comparing anything to NULL with = yields UNKNOWN (not TRUE), so no rows qualify. Use the predicates IS NULL and IS NOT NULL to test for NULLs.

  21. How does NULL behave in arithmetic and aggregate functions?

    Arithmetic with NULL yields NULL (e.g., $5 + \text{NULL} = \text{NULL}$). Aggregate functions like SUM, AVG, MIN, MAX ignore NULLs, but COUNT(*) counts all rows while COUNT(column) ignores NULLs.

  22. Evaluate TRUE OR UNKNOWN and TRUE AND UNKNOWN in SQL three-valued logic.

    TRUE OR UNKNOWN = TRUE (because OR is true if either operand is true). TRUE AND UNKNOWN = UNKNOWN (AND cannot be confirmed true while the other operand is unknown). FALSE AND UNKNOWN = FALSE.

  23. What is DDL and which statements belong to it?

    Data Definition Language defines and modifies schema objects. Statements: CREATE, ALTER, DROP, TRUNCATE, and RENAME. They act on structures like tables, indexes, views, and schemas.

  24. What does TRUNCATE do and how does it differ from DELETE?

    TRUNCATE quickly removes all rows from a table. It is DDL (typically auto-committed, minimal logging, resets identity, cannot use WHERE), whereas DELETE is DML that removes rows one-by-one, can be filtered with WHERE, and is transaction-controllable/rollbackable.

  25. What is DML and which statements belong to it?

    Data Manipulation Language changes the data within tables. Core statements: INSERT (add rows), UPDATE (modify rows), DELETE (remove rows), and MERGE (upsert). Some classifications include SELECT here as well.

  26. What is DQL and its single statement?

    Data Query Language is used to retrieve data; its statement is SELECT (with clauses like FROM, WHERE, GROUP BY, HAVING, ORDER BY). It is often grouped under DML in some taxonomies.

  27. State the logical order of evaluation of the main SELECT clauses.

    FROM (and JOINs) โ†’ WHERE โ†’ GROUP BY โ†’ HAVING โ†’ SELECT โ†’ DISTINCT โ†’ ORDER BY โ†’ LIMIT/OFFSET. Note this differs from the written order, which starts with SELECT.

  28. What is the difference between WHERE and HAVING?

    WHERE filters individual rows before grouping and cannot use aggregate functions. HAVING filters groups after GROUP BY and can reference aggregates (e.g., HAVING COUNT(*) > 5).

  29. What is DCL and which statements belong to it?

    Data Control Language manages privileges/permissions. Statements: GRANT (give privileges to users/roles) and REVOKE (remove them).

  30. What is TCL and which statements belong to it?

    Transaction Control Language manages transactions. Statements: COMMIT (make changes permanent), ROLLBACK (undo to a consistent state), SAVEPOINT (set a rollback marker), and SET TRANSACTION (configure properties).

  31. What are the ACID properties of a database transaction?

    Atomicity (all-or-nothing), Consistency (moves DB from one valid state to another respecting constraints), Isolation (concurrent transactions don't interfere), and Durability (committed changes survive failures).

SQL & Databases Relational Database Fundamentals FAQ

What is in the SQL & Databases Relational Database Fundamentals syllabus?

SQL & Databases Relational Database Fundamentals is split into 4 chapters: Database Concepts and Architecture, Keys and Integrity Constraints, Data Types and Schema Definition and SQL Sublanguages Overview. Together they contain 16 topics.

How many chapters are in SQL & Databases Relational Database Fundamentals?

4 chapters, containing 16 topics. The largest chapter is Database Concepts and Architecture, with 4 topics.

Are there flashcards for SQL & Databases Relational Database Fundamentals?

Yes โ€” a 51-card Relational Database Fundamentals deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.