Week 5
Week 5
This slide deck consists of slides used in 2 lecture videos in Week 5. Below is a
list of shortcut hyperlinks for you to jump into specific sections.
Merge
Transactions
Sorted
https://en.wikipedia.org/wiki/IBM_729
Random
Access
• When you can randomly
access data...
• How can you layout data
to be most efficient?
• Sorting might not be the
best idea
https://en.wikipedia.org/wiki/Hard_disk_drive_platter
Structured Query Language
• Structured Query
Language (SQL) came out
of a government /
industry partnership
• National Institute of
Standards and Technology
(NIST)
https://youtu.be/rLUm3vst87g
SQL
Structured Query Language is the
language we use to issue
commands to the database
- Create/Insert data
- Read/Select some data
- Update data
- Delete data
http://en.wikipedia.org/wiki/SQL
https://en.wikipedia.org/wiki/ANSI-SPARC_Architecture
Relational Databases
Relational databases model data by storing rows
and columns in tables. The power of the relational
database lies in its ability to efficiently retrieve data
from those tables and in particular where there are
multiple tables and the relationships between
those tables involved in the query.
http://en.wikipedia.org/wiki/Relational_database
Common Database Systems
• Three major Database Management Systems in wide use
- Postgres – Open source, enterprise-scale, very tweakable
- Oracle - Large, commercial, enterprise-scale, very tweakable
- MySql - Simpler but very fast and scalable - commercial open source
- SqlServer - Very nice - from Microsoft (also Access)
• Many other smaller projects, free and open source
- HSQL, SQLite, ...
Database Model
A database model or database schema is the structure
or format of a database, described in a formal
language supported by the database management
system. In other words, a “database model” is the
application of a data model when used in conjunction
with a database management system.
http://en.wikipedia.org/wiki/Database_model
SQL
Structured Query Language is the language we use to issue
commands to the database
- Retrieve data
- Update data
- Delete data
http://en.wikipedia.org/wiki/SQL
Lets Make a Database
https://www.dj4e.com/lectures/SQL-01-Basics.txt
$ sqlite3 zip.sqlite3
Start Simple - A
SQLite version 3.11.0 2016-02-15 17:29:24
Enter ".help" for usage hints. Single Table
sqlite> .tables
sqlite> CREATE TABLE Users(
...> id INTEGER NOT NULL
...> PRIMARY KEY AUTOINCREMENT, CREATE TABLE Users(
...> name VARCHAR(128), id integer NOT NULL
...> email VARCHAR(128) PRIMARY KEY
...> ) ;
AUTOINCREMENT,
sqlite> .tables
Users name VARCHAR(128),
sqlite> .schema Users email VARCHAR(128)
CREATE TABLE Users( );
id INTEGER NOT NULL
PRIMARY KEY AUTOINCREMENT,
name VARCHAR(128),
email VARCHAR(128)
);
sqlite> https://www.dj4e.com/lectures/SQL-01-Basics.txt
SQL: Insert
The Insert statement inserts a row into a table
http://sqlitebrowser.org/
Acknowledgements / Contributions
These slides are Copyright 2019- Charles R. Severance (www.dr- Continue new Contributors and Translators here
chuck.com) as part of www.dj4e.com and made available under a
Creative Commons Attribution 4.0 License. Please maintain this last
slide in all copies of the document to comply with the attribution
requirements of the license. If you make a change, feel free to add
your name and organization to the list of contributors on this page as
you republish the materials.