AI Academy
Promotion
CodeGym University
Learning
Courses
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme
Lessons
Reviews
About us
Start
Start learning
Start learning now
My Progress
Courses
University
Quest Map
Lessons
SQL
SQL
Level 19
Foreign Keys:
FOREIGN KEY
SQL SELF
Level 19,
Lesson 0
In this article, you'll find out what foreign keys are in relational databases, why you need them, how to use them to link tables and keep your data consistent, plus you'll see examples of different types of relationships and the syntax for creating foreign keys in PostgreSQL.
Creating Foreign Keys When Creating Tables
SQL SELF
Level 19,
Lesson 1
Learn how to create foreign keys in PostgreSQL, why you need them, and how to use them right to keep your data solid and organize relationships between tables. Examples, syntax, practical tips, and common mistakes — all in one lecture!
Using
ON DELETE CASCADE
and
ON UPDATE RESTRICT
SQL SELF
Level 19,
Lesson 2
Learn how to manage relationships between tables in relational databases using cascade operations and constraints. We'll break down, with examples, how to automate deleting related data and protect data integrity when making changes.
Modeling a
ONE-TO-MANY
Relationship Between Tables
SQL SELF
Level 19,
Lesson 3
Learn how to set up one of the most common relationships in relational databases —
one to many
(
ONE-TO-MANY
). Using customers and orders as an example, we’ll break down creating tables, adding foreign keys, inserting and selecting data, plus typical mistakes and how to dodge them.
Modeling a MANY-TO-MANY Relationship Using a Join Table
SQL SELF
Level 19,
Lesson 4
Learn how to properly implement a "many-to-many" relationship in relational databases using a join table. Examples of creating tables, inserting data, and running SQL queries for managing these relationships like a pro.
Please enable JavaScript to continue using this application.