Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intro to Databases

Intro to Databases

Intro to Databases is a 1 hour introduction, with live coding examples, about databases to undergraduate students.

Preetam Jinka

March 18, 2014
Tweet

More Decks by Preetam Jinka

Other Decks in Programming

Transcript

  1. 1. The structure of data. - How does the database

    look at data? 2. The questions you can ask. - Queries
  2. Types • Relational ◦ MySQL, PostgreSQL, Oracle, … • Document

    stores ◦ MongoDB, CouchDB, Couchbase, … • Graph ◦ Neo4j, … • Key-value stores ◦ File system, Redis, FoundationDB, … • Search ◦ Lucene, Solr, Elasticsearch, … … and a bunch of others I’m missing.
  3. Types • Relational ◦ MySQL, PostgreSQL, Oracle, … • Document

    stores ◦ MongoDB, CouchDB, Couchbase, … • Graph ◦ Neo4j, … • Key-value stores ◦ File system, Redis, FoundationDB, … • Search ◦ Lucene, Solr, Elasticsearch, … … and a bunch of others I’m missing.
  4. File systems! key value /etc/resolv.conf # Dynamic resolv.conf(5) file for

    glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.1.1 .gitignore ## .gitignore ## # dependencies node_modules/ # secret tokens tokens.js
  5. Relational databases username first name last name bob Bob Barker

    alice Alice Cooper pj Preetam Jinka Languages table username language bob JavaScript alice C++ pj Go Users table
  6. Relational databases username first name last name bob Bob Barker

    alice Alice Cooper pj Preetam Jinka Languages table username language bob JavaScript alice C++ pj Go Users table Relation!
  7. SQL Structured Query Language This is how we interact with

    most, if not all, relational databases.
  8. Example document { "_id": "post_1", "title": "Hello, world", "content": "This

    is my first blog post!", "tags": ["general"] } post_1 is the “key”
  9. Document database queries • Get individual documents • Find documents

    that ◦ have a certain value ◦ have properties that… ▪ have a certain value
  10. The application and the database Application Application Application Database State

    State State “stateless web application are far more flexible and scalable than their stateful counterparts” — Application State - We all want to be Stateless
  11. Twelve-Factor App Methodology 12factor.net “Twelve-factor processes are stateless and share-nothing.

    Any data that needs to persist must be stored in a stateful backing service, typically a database.”