Download presentation
Presentation is loading. Please wait.
1
What is sql?
2
Databases In the past, databases mostly held boring stuff: census data, employee records, bank accounts, … Today, databases hold virtually all of humankind’s collected information Everything you’ve ever read, seen (or done according to Snowden) Everything on the web (cat pictures) Scientific data (mostly LHC stuff) Medical data and so on Corny art from:
3
Databases are interesting
Databases use restricted programming languages One of the few places where non-Turing-complete languages are an advantage This leads to very terse programming and deep query-optimization problems Concurrency and Transactions are essential Many activities happen simultaneously Need to heavily utilize parallel programming techniques
4
What is the advantage to SQL not being Turing-Complete?
Easier to optimize Easier to write Lies! SQL is Turing-complete I don't know what Turing-complete is
5
Data Models - Components
Mathematical representation of the data Relational Models (CSV) = tables Semi-structured Models (XML, JSON) = trees/graphs Operations on data (what is allowed, i.e. comparisons, equality, math) Constraints (what types of data are allowed, and where)
6
Attributes (column headers)
Relations are tables Attributes (column headers) name FavoriteShow Ian Stargate SG1 Cam True Detective Caleb GLTAS maybe Tuples (rows) Relation name shows
7
Schemas (sound familiar?)
Relation schema = relation name and attribute list Optionally: types of attributes Example: shows (name, FavoriteShow) or shows (name TEXT, FavoriteShow TEXT) Database = collection of relations Database schema = set of all relation schemas in the database
8
Why Relations? Very simple model
Often (but not always) matches how we think about data Abstract model that underlies SQL, the most important database language today
9
Database Schemas in SQL
SQL is primarily a query language, for getting information from a database. But SQL also includes a data-definition component for describing database schemas.
10
What is the difference between: Record, tuple, and row
Nothing (in the context of this class) The way they are spelled How insulting they are Whether the order of the elements matter
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.