Skip to content

Instantly share code, notes, and snippets.

@mjapanwala
Last active June 28, 2023 05:59
Show Gist options
  • Save mjapanwala/75a12ddef9f241e469a7aedfdd4c3285 to your computer and use it in GitHub Desktop.
Save mjapanwala/75a12ddef9f241e469a7aedfdd4c3285 to your computer and use it in GitHub Desktop.
One - Many Relationship
In a one to many relationship these things are key.
Suppose you have two tables, one users and the other is orders. In the users table you can have columns such as
PRIMARY_KEY UNIQUE AUTO_INCREMENT number, VARCHAR(255) email.
The orders table you have the column order_date date, PRIMARY_KEY AUTO_INCREMENT UNIQUE, price FLOAT, FOREIGN_KEY users.PRIMARY_KEY
This would be a parent - child relationship, the parent is the users and the child is the orders.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment