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.
The written form of SQL queries is closely related to tuple relational calculus, while their implementation requires mapping into expressions of relational algebra. There’s an important step here: the SQL queries set out what information we want to find out, and the database engine beneath does some serious planning work to determine how to efficiently compute that information.
The lecture also covered sets and bags, fiddling details of quotation in SQL token syntax, the UK Labour Market Survey, and the offside rule in football.
Link: Slides for Lecture 7
Homework
Do This
The features that characterise a reliable implementation of database transactions are standardly initialized as the ACID properties.
Find out what each letter A C I D stands for here, and what those four terms mean.
Try This
Write some SQL by hand using one of these web demonstrators.
- SQL Tryit. This is from W3Schools and is ready set up with some small sample tables.
- SQL Bolt Includes a guided SQL tutorial.
- SQL Fiddle This is a substantial developer tool: significantly more functionality, but also a little bit more work to get operating.
References
2D Goggles By Sydney Padua. Contains mathematics, computer science, and crime-fighting. |
|
UK Labour Market, January 2016 The figures in the lecture were taken from Section 4: Actual hours worked. Links: Office for National Statistics; Labour Market Statistical Bulletin |
|
One of these players is offside |
Association Football Offside Law
Important and conceptually well-motivated; tried, tested and improved over decades; but notoriously difficult to use and an endless source of dispute. |