Table constraints - PRIMARY KEY
56.5
Exercise

PRIMARY KEY with multiple columns

Write a set of SQL statements together to:

  1. create a new table teachers with the following columns, data types and constraints.

    column data type constraint
    teacherTypeId INTEGER NOT NULL
    name TEXT NOT NULL
    department TEXT NOT NULL
  2. set a combination of teacherTypeId and department as the PRIMARY KEY on teachers

  3. add these record rows to the created table teachers

    teacherTypeId (INTEGER) name (TEXT) department (TEXT)
    112 Jofra SQL
    113 Kagiso Ruby
    114 Marcus SQL