The following MySQL query on a relational database generates the error "Every derived table must have its own alias". Based on every derived table must have its own alias and Every derived table must have its own alias error. I give aliases to every table in sub-queries and the resultant table of the unions. Yet that did not seem to fix it. Can someone explain what is still missing in here?
SELECT major
FROM
(SELECT major, count(*) amount
FROM
(((SELECT major
FROM
(SELECT tutorID
FROM questionAnsweredBy
AS t1)
NATURAL JOIN
(SELECT tutorID, major
FROM tutor
AS t2) AS t12
)
AS t3
UNION
(SELECT major
FROM
(SELECT tutorID
FROM expertAnswerGivenBy
AS t4)
NATURAL JOIN
(SELECT tutorID, major
FROM tutor
AS t5) AS t13
)
AS t6) AS t15
UNION
(SELECT major
FROM
(SELECT tutorID
FROM textbookSolutionGivenBy
AS t7)
NATURAL JOIN
(SELECT tutorID, major
FROM tutor
AS t8) AS t14
)
AS t9) AS t16
GROUP BY major
AS t10
)
AS t11