Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 311335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:54:55+00:00 2026-05-12T07:54:55+00:00

I have been coding with MySQL DBs for a couple years now and I

  • 0

I have been coding with MySQL DBs for a couple years now and I have never used a foreign key. Now, I understand that a foreign key is like an ID on one table that corresponds with a primary key of another table. I have a user table on my site and probably around 10 other tables that all correspond with the primary key of my user table – however they are not set as foreign keys.

What am I missing out on by not having these 10 other tables have a foreign key? I mean, as far as I can tell they basically are a foreign key except they do not have that value saved/assigned to them in the DB.

Is there some other benefit here that I am just not aware of?

I realize too that a primary key cannot be null, but a foreign key can be. This will never be an issue in my case as my user table is created, and and when a new user is added to my user table I add their appropriate entry to the 10 other tables.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:54:56+00:00Added an answer on May 12, 2026 at 7:54 am

    A FOREIGN KEY serves two purposes:

    • It ensures that you relationships are always consistent at the cost of some checking overhead
    • It (disputably) simplifies cascaded updates and deletes.

    In most cases, this functionality can be more efficiently implemented using other tools.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 148k
  • Answers 148k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You should put it in action where you want it… May 12, 2026 at 9:20 am
  • Editorial Team
    Editorial Team added an answer Your variable values won't persist between page loads, thus resetting… May 12, 2026 at 9:20 am
  • Editorial Team
    Editorial Team added an answer I would use a projection (SetProjection()) and SetResultTransformer() to strongly-type… May 12, 2026 at 9:20 am

Related Questions

I am mainly looking for good development practices specially when working in conjunction with
I've been coding since my early teenager years. I started out with HTML, went
I'm running PHP 5 and MySQL 5 on a dedicated server (Ubuntu Server 8.10)
I want to test some PHP on my local machine running Windows XP Professional.
I've been coding php for a while now and have a pretty firm grip

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.