Download Link to Slides

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Data analysis wikipedia , lookup

Theoretical computer science wikipedia , lookup

Corecursion wikipedia , lookup

Data assimilation wikipedia , lookup

Neuroinformatics wikipedia , lookup

Transcript
WHAT IS SQL?
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:
https://www.flickr.com/photos/
datacorpltd/19556451409
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
WHAT IS THE ADVANTAGE TO SQL NOT BEING
TURING-COMPLETE?
1.
2.
3.
4.
Easier to optimize
Easier to write
Lies! SQL is Turing-complete
I don't know what Turing-complete is
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)
RELATIONS ARE TABLES
Tuples
(rows)
Attributes (column
headers)
name
FavoriteShow
Ian
Stargate SG1
Cam
True Detective
Caleb
GLTAS maybe
Relation
name
shows
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
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
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.
WHAT IS THE DIFFERENCE BETWEEN: RECORD,
TUPLE, AND ROW
1.
2.
3.
4.
Nothing (in the context of this class)
The way they are spelled
How insulting they are
Whether the order of the elements matter