Pregunta

I have a table of users, students and teachers. For example I want to create a new student and assign him a user account from the list. This works for me, but it is possible to assign the same user account to more students. How to fix this? Thank you.

¿Fue útil?

Solución

you should add unique index in students table, user_id field, this not allow to repeat, the same user_id, in students table.

http://dev.mysql.com/doc/refman/5.0/es/create-index.html.

You should use, "UNIQUE".

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top