0

I'm new to mySQL relastionships and I'm wondering if you can help me out.

This is what I want to do:

Users Table

user_id
user_name
pass_word
permission_id

Permissions Table

p_id
permission_name
permission_type

I want to create a relationship between p_id (permissions table) & permission_id (user table) so when I query the user table it also brings through the corresponding permission name & type?

Is this possible or am I getting it all wrong?

Should I just use joins?

1
SELECT  u.user_id, 
        u.user_name, 
        u.pass_word,
        p.permission_name,
        p.permission_type
FROM Users u
  INNER JOIN Permissions p
ON u.permission_id  = p.p_id;

Max.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.