Designing a course table
The school's administration decides to use its database to store course details. Given that this is the first attempt at building the database, they are unsure of which columns to include in the course
table. Below is a list of possible columns and a description of the data type for each. In this exercise, you will choose the appropriate columns for this table from the list of possible column choices:
id
- aPRIMARY KEY
for the coursename
- a variable length (max 50, not NULL) string for the course namemeeting_time
- a time representing the meeting time of the coursestudent_name
- a variable length (max 50, not NULL) string representing an enrolled studentmax_students
- an integer for maximum student enrollment (classrooms can only fit 30 desks safely)
This exercise is part of the course
Creating PostgreSQL Databases
Exercise instructions
- Create a
course
table which satisfies 2NF using 3 columns from the list above.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
-- Create the course table
___ ___ ___ (
-- Add a column for the course table
___ ___ ___ ___,
-- Add a column for the course table
___ ___(___) ___ ___,
-- Add a column for the course table
___ ___
);