Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to merge two tables overwriting the elements which are in both?

I need to merge two tables, with the contents of the second overwriting contents in the first if a given item is in both. I looked but the standard libraries don't seem to offer this. Where can I get such a function?

like image 844
RCIX Avatar asked Aug 16 '09 03:08

RCIX


People also ask

How do you unify two tables?

Click at anywhere of the table you want to drag, then the cross sign will be appeared, then select the cross sign to select the whole table. 2. Press Ctrl + X to cut the table, then put the cursor at the place of the table you want to insert the cut table, right click to select Merge table from the context menu.

Which option is used to combine two tables?

Merging tables by columns. Multiple tables can be merged by columns in SQL using joins. Joins merge two tables based on the specified columns (generally, the primary key of one table and a foreign key of the other). Below is the generic syntax of SQL joins.


1 Answers

for k,v in pairs(second_table) do first_table[k] = v end 
like image 117
Doug Currie Avatar answered Oct 13 '22 11:10

Doug Currie