Hello. There are three tables (two with data and one for many-to-many communication):
users: id, name, email (уникален); groups: id, title; group_users: id_user, id_group;
Data is added to the users table, from a file or from another table. For all new entries, links are added to the same new group. In the data records with email are already available in the users table. In this case, you only need to add a new connection of the old record to the new group.
Is it possible to implement this using MySQL? If so, how to make it more elegant? Thank.
UPD:
There is an N-th number of new users, all of them must be added to One New Group. If a user already exists (checked by email), then add an existing user to the new group, the same as new users.
Title groups is not unique, although it does not matter.
Ts sub-question: is it possible to insert into a table with a connection with a single query (without bothering about duplicates for now)?