+ 1

Can i use a single query to create a table and simultaneously insert data into another different table

Example : when new user is registered . 1. A table must be created separately for that user with some columns and 2. simultaneously the userid ,usrname etc should be inserted in a general table which consists info of all registered users . if possible give some hint or example. Thanks in advance !!!

2nd Jan 2017, 5:00 PM
Sugash Rajavelu
Sugash Rajavelu - avatar
3 Antworten
+ 5
Yes, if I understood what you need. Look for triggers, they are functions that literally triggers when a certain event comes up, for example a creation of a new user. At this trigger you can create a table and insert its values.
3rd Jan 2017, 7:51 AM
Olavo André Parno
Olavo André Parno - avatar
+ 1
The best is to use views .
3rd Feb 2017, 4:24 PM
David Chikunguru
David Chikunguru - avatar
+ 1
views at list safe guards the original data in the database to be tempered with unnecessarily as views put a restriction that won't corrupt data.
3rd Feb 2017, 4:28 PM
David Chikunguru
David Chikunguru - avatar