Pergunta de entrevista da empresa Oracle

Question: Write a simple query to show data in a single resultset. Resultset should have department table data first order by deptname and followed immediately by sub-department table data also ordered by deptname. Both tables data should be wrapped in a single resultset, with the above criteria.

Respostas da entrevista

Sigiloso

7 de ago. de 2016

Me: i didn't try to get this kind of resultset in any of my past projects. Never got such a requirement either. Interviewer: now i am giving the requirement do it. Me: tried for sometime but i couldn't crack so asked him to goahead with next question

1

Sigiloso

7 de mai. de 2019

There may be 2 solutions . 1) use JOIN to join these tables and then ORDER BY both columns in the query. 2) make 2 independent queries and then UNION them to get a single result set