mysql - Adding column on specific row location -


its quick question :

i have user table , has fields name, address , books_bought. books_bought foreign key , value pk other table. after 1st insert, fill out of fields , after second insert want add additional books_bought, creating array of books_bought values?

you're doing wrong way around - one-to-many relationship i.e. many books bought 1 user. need have foreign key on many side of relationship, instead of having foreign key books_bought on users table, add foreign key users on books_bought table.

if have books table , users table, many-to-many relationship , need link table go between them hold foreign keys.


Comments