# Tutorial Notes and Exercises

Tutor notes and solutions for Tutorial 2 are now on the tutorial page, together with next week’s exercises. Tutorial 3 is about formulating queries in tuple relational calculus and finding ways to compute them in relational algebra.

Have a look at the exercises now, and if you have questions about anything then ask on Piazza or after lectures.

# Lecture 7: SQL

Today’s lecture introduced the basic structure and format of SQL queries: SELECT … FROM … WHERE …. That’s enough to write a huge range of queries, from single summary statistics to large integrated views that bring together multiple tables.

# Lecture 6: Tuple Relational Calculus

Today, another language for talking about databases. This one is the Tuple Relational Calculus for writing queries that describe information to be extracted from the linked tables of a relational database. There’s a separation of roles here: the tuple relational calculus is good for succinctly stating what we want to find out; while relational algebra from the last lecture describes how to combine and sift tables to extract that information from the data. We distinguish what information we want from how to compute it.
Continue reading Lecture 6: Tuple Relational Calculus

# Lecture 5: Relational Algebra

This morning’s lecture presented a mathematical language for slicing and dicing the structured tables of the relational model: selection, projection, renaming; union, intersection, difference; cross product, join, equijoin and natural join. A key feature of this relational algebra is that just six of these operations are enough to capture an extremely wide range of queries and transformations of data. Database implementors work hard to build highly efficient engines to carry out these operations, which can then support many different kinds of user application.
Continue reading Lecture 5: Relational Algebra

# Lecture 4: From ER Diagrams to Relational Models

Today’s lecture reviewed the high-level conceptual language of ER diagrams and the more concrete structures of the relational model; followed by some recipes for translating from the first into the second. This isn’t always an exact match, and for any particular ER diagram we might go back to its original scenario description to decide how to best represent it as a relational model. Even so, this kind of step-by-step staging towards a fully formal representation is an effective route to capturing the subtleties of real-world systems.
Continue reading Lecture 4: From ER Diagrams to Relational Models

# Tutorial Exercises

The first set of tutorial exercises are now online. Click on the thumbnail to the right to download them. Please read the information box on the opening page before you start work on these.

# Lecture 3: The Relational Model

Today’s lecture expanded on last week’s material on Entity-Relationship modelling, and then set out the basic elements of the Relational Model for structured data. While ER diagrams provide a conceptual language for describing things as they are, and have applications outside databases for general organisation and management, the relational model is explicitly intended as a mathematically precise scheme for the computer-assisted creation and querying of large datasets.
Continue reading Lecture 3: The Relational Model

# Lecture Slides Online

The slides for each Inf1-DA lecture are available in advance from the Lectures web page. On the day of the lecture you’ll see them marked “(Handout)” as that’s the version in the 3-up printed sheets. After the lecture itself I put up a blog post with a copy of the slides as displayed — sometimes that has a few more bits and pieces included.

Sometimes this means the page changes faster than web and browser caches expect: if you can’t get the slides for the day, try refreshing.

# Lecture 2: Entities and Relationships

Today’s lecture opened the topic of structured data with an introduction to Entity-Relationship Modelling and the graphical language of ER diagrams. This language is important for planning and structuring databases, bridging the gap between informal conceptual design and the logical precision required for machine implementation.
Continue reading Lecture 2: Entities and Relationships