Blog - Our findings and learning
You no need to try to learn something. With the experience of trying, we learn what works and how it works. We share the same with you to learn from our experience.
Write a SQL query to display alternate records from a table?
For even rows: SELECT *FROM (SELECT e.*,MOD(ROWNUM,2) rn FROM employees E)WHERE rn =0; For odd rows: SELECT *FROM (SELECT e.*,MOD(ROWNUM,2) rn FROM employees E)WHERE rn
2013-07-17
No Comments
Write a query to display manager and employees under them?
select manager,count(employee), rtrim(xmlagg(xmlelement(e,employee||’,’)).extract(‘//text()’),’,’) as “Employees under the Manager” from (select e2.first_name manager,e1.first_name employee from employee e1,employee e2 where e1.reporting_to=e2.employeeid) group by manager;
2013-07-17
No Comments