in

Schema for object with multiple types


I’m new to SQL. In my database, I have a “responses” table.

Responses can be of multiple types. For each type, I have to store unique data associated with it.

  • Text: content, title
  • Audio: audio url
  • Video: video id, video thumbnail, video url.

What’s the best way to go about creating tables for this?

Should I have just one “responses” table that contains columns for each type?

responses
- id
- type
- sender
- content
- audio_url
- video_thumbnail 
- video_url
...

Or should I split the content into different tables that can be linked together via primary keys?

responses
- id
- name
- text_content_id
- video_content_id
- audio_content_id



Source: https://stackoverflow.com/questions/70720280/schema-for-object-with-multiple-types

Russia Arrests REvil Ransomware Gang Responsible for High-Profile Cyber Attacks

Flutter app fetching nasa’s picture of the day api