Fixed union query since union combines results from two queries, but the number of columns and their data types must match.

This commit is contained in:
K 2024-11-09 23:10:17 +05:30
parent 3dc24979ba
commit dcadee52ce
Signed by: notkshitij
GPG Key ID: C5B8BC7530F8F43F

View File

@ -90,7 +90,7 @@ SELECT name, cost, domain, quantity FROM Companies RIGHT JOIN Orders on Companie
4. Find names, costs, domains and quantities for companies using Union operator. 4. Find names, costs, domains and quantities for companies using Union operator.
```sql ```sql
SELECT name, cost FROM Companies UNION SELECT domain, quantity FROM Orders; SELECT name AS info, cost AS value FROM Companies UNION SELECT domain AS info, quantity AS value FROM Orders;
``` ```