There is a table of users , where the login and password are written, there is a separate table of students , where all the information about the student is such as name, age, address.

How can I connect them, if during registration a username and password go to users , and after adding information about a student, the info goes to another?

  • Try to write more detailed questions. Explain exactly what you see the problem, how to reproduce it, what you want to get as a result, etc. - Nicolas Chabanovsky

1 answer 1

Very strange question. What does it mean to connect? Alright? Then you will need to create a third table (or edit one of them) and write a query that copies data from one table to another. I certainly didn’t work much with SQL, maybe there’s a better way. But with the help of PHP you can definitely and it is done very trivially. Possible without PHP, pure SQL. One click is unlikely you will do it. Although maybe I'm wrong.

If you only need to connect them at the time of the request, use Inner Join. For example:

 SELECT users.login, students.name FROM users INNER JOIN students WHERE users.id = students.id 

And you can save it in a table like this:

 SELECT users.login, students.name INTO newTableName FROM users INNER JOIN students WHERE users.id = students.id