Get startedGet started for free

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 - a PRIMARY KEY for the course
  • name - a variable length (max 50, not NULL) string for the course name
  • meeting_time - a time representing the meeting time of the course
  • student_name - a variable length (max 50, not NULL) string representing an enrolled student
  • max_students - an integer for maximum student enrollment (classrooms can only fit 30 desks safely)

This exercise is part of the course

Creating PostgreSQL Databases

View Course

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
  	___ ___
);
Edit and Run Code