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

  • SEARCH
  • Home
  • 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 8687117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:02:22+00:00 2026-06-12T23:02:22+00:00

Hi I am a bit confused regarding relational databases. This is what I understand

  • 0

Hi I am a bit confused regarding relational databases.
This is what I understand so far:

Let’s say we have two tables users and profile

users : username , password
profile: address , telephone , country , city etc.

Oviously a relationship should be created beetween this two tables because each user has an addres ,telephone etc. But how does MySql or Sql-server know witch addres belongs to what user.

I have seen in some tutorials that an aditional field is created in this case users_id for the profile.What I do not understand is if the items in the field are automaticly generated in regards to the user table?Also how can I be sure I am not retrieving the wrong users profile?

Can anyone please explain this concept to me or point me on some tutorials pls?

  • 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-06-12T23:02:23+00:00Added an answer on June 12, 2026 at 11:02 pm

    What you will need is a Foreign key in any of the table. Since it’s a 1-1 relationship in the example you mention (based on the logic that a user can only have one profile) I would have a field called user_id in the profile table.

    TABLE users:
    id, username, password
    
    TABLE profile:
    id, user_id, presentation
    

    When you create a user use it’s inserting-id number when inserting to the profile table.

    Example of some bad php code ( do not use this code):

    mysql_query('INSERT INTO users (username, password) VALUES ("admin", "admin")');
    $uid = mysql_insert_id();
    mysql_query('INSERT INTO profile (user_id, presentation) VALUES ( ' . $uid . ', "I love my cats")');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to C++ and a bit confused regarding auto_ptr. I have a class
I have some questions regarding VB.NET bit shifting. I understand the << >> operators
Sorry for the rather ignorant question, but I'm a bit confused regarding these two
I'm a bit confused at the moment regarding how to have a more maintainable
I'm a bit confused regarding the document architecture. Lets look at MSN for Mac
Bit confused here, I have an on-demand instance but do I get charged even
I'm a bit confused regarding the dollar sign in jQuery, and was hoping someone
I am little bit confused regarding worst Case time and Avg case Time complexity.
After reading the Android NDK documentation i am a bit confused on this issue.
I am a bit confused regarding C# WPF. How can I set a WPF

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.