How many rows does UNION ALL return with LIMIT 3 at the end?
The query combines department names and customer names into a single list. A LIMIT 3 appears after the union. How many rows will the query return? The result depends on the DBMS. Choose a DBMS and answer for it. If the query fails, select “Error.”
Predict the resultSubqueries, CTEs, EXISTS / IN, UNIONMiddleAnalystData EngineerBackend
Input data · iv_customers
| id | name | city |
|---|---|---|
| 1 | Alice | Berlin |
| 2 | Bob | Paris |
| 3 | Carol | NULL |
| 4 | Dan | Berlin |
| 5 | Eve | Paris |
Input data · iv_departments
| id | name |
|---|---|
| 1 | Sales |
| 2 | Engineering |
| 3 | Analytics |
| 4 | Legal |
Query
SELECT name FROM iv_departments
UNION ALL
SELECT name FROM iv_customers
LIMIT 3