Updating multiple databases

Hi all Started learning Laravel a couple of weeks ago and now starting to write my first application as really this is the best way to learn so forgive me if my attempts are naive.

What is the best way to create/update one of more tables as part as my user registration?

Let us start with a simple table: UPDATE staff SET salary = 1200 WHERE name = ' Bob'; UPDATE staff SET salary = 1200 WHERE name = ' Jane'; UPDATE staff SET salary = 1200 WHERE name = ' Frank'; UPDATE staff SET salary = 1200 WHERE name = ' Susan'; UPDATE staff SET salary = 1200 WHERE name = ' John'; UPDATE staff SET salary = 1200 WHERE name = ' Bob'; UPDATE staff SET salary = 1250 WHERE name = ' Jane'; UPDATE staff SET salary = 1200 WHERE name = ' Frank'; UPDATE staff SET salary = 1250 WHERE name = ' Susan'; UPDATE staff SET salary = 1200 WHERE name = ' John'; We are no longer setting all the salary fields to the same value, so we can’t collapse it into a single statement.

But we can group the updates according to the value being set, and then do one UPDATE statement per distinct value.

I have two tables, one called 'members' and the other 'profiles'.

I want to store the users email address and password in the 'members' table and then their real name etc. I need the members id to be stored in the profiles table. This is storing the data as I wanted and then I am getting the ID for that stored record so I can use it in the 'profiles' table.

We can easily contrive for an “updates” table to exist by creating a temporary table and populating it.

It is relatively straightforward to populate a table with multiple rows with just one query (or at least, far fewer queries than the number of rows desired).In this case there are two distinct values, so we can do it in two UPDATE statements: So we can reduce the number of queries from five to two. But the extent to which this helps us reduces as the proportion of distinct SET values goes up.Eventually every SET value is different, for example: UPDATE staff SET salary = 1125 WHERE name = ' Bob'; UPDATE staff SET salary = 1200 WHERE name = ' Jane'; UPDATE staff SET salary = 1100 WHERE name = ' Frank'; UPDATE staff SET salary = 1175 WHERE name = ' Susan'; UPDATE staff SET salary = 1150 WHERE name = ' John'; Since every SET clause is now different, we can’t coalesce any queries using the approaches mentioned before, so we still have one UPDATE statement for every row requiring changes. What if we had a database table which contained a representation of the updates we wanted to make, e.g.A requirement arises in many systems to update multiple SQL database rows.For small numbers of rows requiring updates, it can be adequate to use an UPDATE statement for each row that requires an update.Is there a good way to Alter a table (add a column) for multiple databases (think like 50 or so). the Tables are all the same and the column added will be the same as well. 4) AND /* No system databases */ (d.state = 0) AND /* Online only */ (d.is_distributor = 0) AND /* Not a distribution database */ (d.is_read_only = 0) AND /* We can write to it */ /* TODO: filter me more?