MySQL Primer

Online resources

Key concepts to understand

  • Database basics

    • Issue query commands to retrieve or edit data
    • Relationships between tables
    • Key terms: database, table, column, row, index
  • Database relationships

    • Records in a table reference a record in another table
    • Why relational databases are useful
    • Primary keys, foreign keys
  • Relationship types

    • one-to-many relationship
    • one-to-one relationship
    • many-to-many relationship
  • How to connect to MySQL from the command line

  • Database-level commands

    • SHOW DATABASES
    • CREATE DATABASE
    • DROP DATABASE
    • USE DATABASE
  • Table-level commands

    • SHOW TABLES;
    • CREATE TABLE
    • DROP TABLE
    • ALTER TABLE
  • Data types for column definitions

    • VARCHAR
    • INT
    • DECIMAL
    • DATE, TIME, DATETIME
    • TEXT
    • How to specify column options
    • How to specify the primary key
    • What is auto-incrementing
  • Table Indexes

    • Why indexes are important
    • How to add and drop indexes
    • Always add indexes on foreign keys
  • How to create users and grant privileges

    • CREATE USER
    • GRANT ALL PRIVILEGES
    • REVOKE ALL PRIVILEGES
    • FLUSH PRIVILEGES
  • Query syntax

    • SELECT
    • WHERE, AND, OR, NOT, LIKE
    • ORDER BY
    • LIMIT, OFFSET
    • JOIN
  • Altering records

    • INSERT INTO
    • UPDATE
    • DELETE
Fork me on GitHub