#The RIGHT JOIN keyword Return all rows from the right table (table_name2), even if there are no
#matches in the left table (table_name1).
syntax->SELECT column_name(s)
FROM table_name1
RIGHT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
////example////
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons
RIGHT JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName
SELECT
pka,
c1,
pkb,
c2
FROM
A
LEFT JOIN B ON pka = fka;
Code language: SQL (Structured Query Language) (sql)
/* https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-left-join/ */
#LEFT JOIN: Return all rows from the left table, even if there are no matches in the right
#table
syntax->SELECT column_name(s)
FROM table_name1
LEFT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
////example/////
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons
LEFT JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName
You need a first lookup for the values that exist in table1, so make a map using an object:
var maps = {};
for (var i = 0; i < table1.length; i++) {
maps[table1[i].attr4] = 1;
}
Then you can loop throught the items in table2 and filter them:
var result = [];
for (i = 0; i < table2.length; i++) {
if (!(table2[i].attr3 in map)) {
result.push(table2[i]);
}
}