In: Computer Science
Given tables customer and customer overview, is there any way to select data common to both of them without using a join?
To merge the result sets of 2 or more SELECT statements, the SQL UNION operator is used. Duplicate rows between the related SELECT statements are excluded.
Each SELECT declaration within the UNION must have the same number of fields with identical data types in the result sets.
UNION removes duplicate rows.
UNION ALL does not remove duplicate rows.
Also, To return the outcomes of 2 or more SELECT statements, the SQL INTERSECT operator is used. However, it returns only the rows that all queries or data sets pick. If a record occurs in one query and not in the other, the effects of the INTERSECT would be omitted.
Use a theta join (you can use whichever compatible join you please to accomplish this) to select a range of entries (entire rows) from math_majors and sci_majors
SELECT math_majors.column1, sci_majors.column2...
FROM math_majors
FULL JOIN sci_majors
ON math_majors.common_field = sci_majors.common_field