I have one table that includes company information (i.e. name, address, business description…) and another table that has user information (i.e. first name, last name, email and password). How do I tie the company table to the user table so that when the user logs in, the company is properly associated with the user? Would I have a userid column in the company table?
I have one table that includes company information (i.e. name, address, business description…) and
Share
Assuming that several users might belong to a single company but only one company may be associated with a user, a companyid in the user table would make the most sense.
To join two tables together where you expect a match between both in all cases, use an INNER JOIN:
Obviously, the above is a simulated query and needs tailoring to match your schema / requirements.