SELECT Salepeople.SNum, SName, CName, Comm FROM
Salepeople, Customers
WHERE Salepeople.City = Customers.City
UNION
SELECT SNum, SName, 'NO MATCH', Comm FROM
Salepeople
WHERE NOT City = ANY ( SELECT City FROM Customers
)
ORDER BY 2 DESC;
Xar gal bir necha so‘rovlarni jamlaganda yumaloq qavslar yordamida
baxolash mezonini ko‘rsatishingiz mumkin. YA’ni
query X UNION query Y UNION query Z;
o‘rniga, yoki
( query X UNION query Y )UNION query Z;
yoki
query X UNION ( query Y UNION query Z );
ko‘rsatishingiz mumkin. CHunki UNION bitta dublikatlarni yo‘qotib
boshqasini qoldirishi mumkin. Quyidagi ikki ifoda
( query X UNION ALL query Y )UNION query Z;
query X UNION ALL( query Y UNION query Z );
bir xil natija qaytarishi shart emas, agar ikkilangan satrlar unda o‘chirilgan
bo‘lsa.