I am developing a database for an eCommerce website, I have written the stored procedure for the following tables,
I have designed in manner where the primary keys of the first three tables (user_master, authentication_master and country_master) are the foreign keys to the table public_master according to my knowledge everything works perfect, while testing my Stored procedures in following modes I got the expected output,
All these testing is done by passing the values manually, for the first three tables there is no issues to be identified, but for the table public_master the foreign key id's should be passed from the other tables.
My question is, how to make that automated default, I understand that we can make that automatic by using the front end programming languages, but as I am new to the MySQL, I just want to know,
How to fetch the primary id's from that three tables and store as a foreign key id's in public_master by using SQL stored procedure?
Is there any need for user defined MySQL functions? if yes, I am expecting the logic.