Relational Databases and SQL
This is a brief introductory module to relational databases and SQL. It mainly targets people that are interested in learning SQL, and does not cover topics such as indexing, transactions, stored procedures, etc.
Additional Resources for Learning SQL
- Introduction to SQL from Khan Academy. Introductory course, with videos explaining the various aspects of SQL.
- W3Schools SQL: An introduction to SQL with hands-on examples
- Learn SQL and SQL: Analyzing Business Metrics: Two short, self-directed online course from Code Academy
- SQL Tutorial
- Learning MySQL: A useful textbook for those interested in learning more about SQL
- W3 Resource and SQL exercises
- Best practices for SQL: A set of useful guidelines for writing readable SQL statements.
- Kickstarter style guide
- Entities, Primary Keys, and Attributes
- Cardinality: One-to-One, One-to-Many, Many-to-Many
In class: Artist-Gallery-Painting example
From ER Diagram to SQL Tables
- Translating ER Diagrams to Tables
- SQL Statements for Creating Tables
Querying a Database Using SQL
- USE, DESCRIBE queries
- Selection queries: *, column, column AS, DISTINCT, ORDER BY, LIMIT
- Where clauses: Boolean conditions, IN, BETWEEN, LIKE
- Aggregation queries: GROUP BY, SUM, AVG, MAX, MIN, ROLLUP
- Join queries: INNER JOIN, OUTER JOIN
- Subqueries and Views