CodeGym
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
  • 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.
    Available
  • 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!
    Available
  • 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.
    Available
  • 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.
    Available
  • 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.
    Available
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning, and a Java developer’s career.
Follow us
Interface language
English
Deutsch Español हिन्दी Français Português Polski বাংলা 简体中文 मराठी தமிழ் Italiano Bahasa Indonesia 繁體中文 Nederlands 日本語 한국어 Bulgarian Danish Hungarian Basa Jawa Malay Norwegian Romanian Swedish Telugu Thai Українська Filipino Turkish Azərbaycan Русский Vietnamese
Programmers Are Made, Not Born © 2026 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2026 CodeGym