topics table

The topics table in the Reddit Clone Database Schema schema has 5 columns, keyed by id, with 1 foreign key to topics. 1 column in subreddit_topics references it.

The site-wide interest taxonomy behind discovery and ad targeting. Self-referencing so Gaming can hold Strategy Games without a second table.

Columns (5)

Columns of the topics table
ColumnTypeConstraintsDescription
iduuidprimary key
parent_iduuidreferences topics.id
slugvarchar(80)unique, not null
namevarchar(80)not null
positionsmallintnot null

Indexes (1)

  • (parent_id, position)

Relationships