140 likes | 153 Views
This review lecture covers various topics in database management, including the relational model, file organization, SQL, query optimization, ER model, and normalization. It also discusses the purpose of databases, data storage on disks and files, relational algebra and calculus, and functional dependencies.
E N D
Midterm Review Lecture 14b
14 Lectures So Far • Introduction • The Relational Model • Disks and Files • Relational Algebra • File Org, Indexes • Relational Calculus • SQL • Sorting & Joining • Optimizing Queries • SQL II • The ER Model • ER -> Relational • Functional Dependencies • Normalization
By Topic • Introduction – what are databases for? (1) • Relational Topics • The Relational Model – basic SQL, Keys, ICs (1) • Relational Algebra (1) • Relational Calculus (1) • SQL (2) • The ER Model (2) • Functional Dependenciesand Normalization (2) • Database Internals • Storing Data: Disks and Files (1) • File Organization and Indexes (1) • External Sorting and Join Algorithms (1) • Query Optimization (1)
Introduction – what are databases for? (1) • Definitions of database, DBMS • Useful properties of database systems • A.C.I.D. • Data Modelling • Querying • Levels of Abstraction • Comparing Database Systems to... • WWW • File Systems • Data Processing Programs
The Relational Model (1) • Tables: Rows and Columns • Basic SQL • Keys • ICs • Referential Integrity
Relational Algebra (1) • Somewhat Procedural Query Language • Basic Ops: • Selection ( s ) Selects a subset of rows from relation (horizontal). • Projection ( p ) Retains only wanted columns from relation (vertical). • Cross-product( ) Allows us to combine two relations. • Set-difference ( — ) Tuples in r1, but not in r2. • Union( ) Tuples in r1 and/or in r2. • Other ops: • Intersection ( ) • Join ( ) – merge 2 tables based on common columns • Division ( / ) – used in “for all” queries
Relational Calculus (1) • Formal logic as declarative Query Language • {S | SSailors S.rating > 7 R(RReserves R.sid = S.sid R.bid = 103)} • Concentrated on Tuple Relational Calculus • Also talked about Domain Relational Calculus
SQL (2) • Data Definition Language (DDL) • Data Manipulation Language (DML) • Range variables in Select clause • Expressions in Select, Where clauses • Set operators between queries: • Union, Intersect, Except/Minus • Set operators in nested queries: • In, Exists, Unique, <op> Any, <op> All • Aggregates: Count, Sum, Avg, Min, Max • Group By • Group By/Having • Other Features • Insert • Delete • Update • Null Values – Outer Joins • Views • Order By • Access Control • Integrity Constraints
The ER Model (2) • A Visual Language for Modelling the Real World • Entities, Relationships, Attributes
Functional Dependencies and Normalization (2) • We’ve just talked about this
Storing Data: Disks and Files (1) • Laying out fields in records in pages in files • Buffer Management
File Organization and Indexes (1) • Heap File vs Sorted File vs B-Tree Index vs Hash Index • What are advantages, disadvantages of each?
External Sorting and Join Algorithms (1) • External Sorting • Sort a file of any size using only 3 pages of memory • Understand optimizations with more memory • Join Algorithms • Nested Loops • Indexed Nested Loops • Sort-Merge Join • Hash Join • What are tradeoffs for different algorithms
Query Optimization • Query Plans – trees of operations • How to change plan to find more efficient one