Skip to content

ga-wdi-lessons/sql-intro

Repository files navigation

Databases

Learning Objectives

Domain Modeling & ERD

  • Draw an Entity Relationship Diagram (ERD)
  • Identify and diagram one-to-one, one-to-many and many-to-many relationships between data entities
  • Distinguish between entities and attributes
  • Discuss data normalization needs and techniques

Basics of Databases, and SQL

Concepts

  • Explain what a database is and why you would use one
  • Explain how a database, a database management system (DBMS) and SQL relate to one another
  • Describe a database schema and how it relates to tables, rows and columns

Mechanics

  • Create a new PostgreSQL database
  • Set up a PostgreSQL database schema with a saved SQL file
  • Seed a PostgreSQL database with a saved SQL file
  • Execute basic SQL commands to execute CRUD actions in a database

Relationships in SQL / SQL JOINs

  • Define what a foreign key is
  • Describe how to represent a one-to-many relationship in SQL database
  • Explain how to represent one-to-one and many-to-many relationships in a SQL DB
  • Distinguish between keys, foreign keys, and indexes
  • Describe the purpose of the JOIN
  • Use JOIN to combine tables in a SELECT
  • Describe what it means for a database to be normalized

Framing

This lesson is broken down into three parts...

  1. Domain Modeling & ERDs
  2. Basics of Databases and SQL
  3. Relationships in SQL

Sample Quiz Questions

  • What is an ERD and why would we use one?
  • What is the distinctive feature of a relational database?
  • How is information stored in a relational database?
  • What are the different types of relations that exist in a relational database?
  • How do we indicate a one-to-many relationship in a database?

Homework: NBA Stats

Screencasts

Practice