can any one answer this query,thank you in advance
Table 1 has 2 columns: EmployeeId, T shirtsize(values can
be 1,2,3)
Table 2 has 2 columns: EmployeeId, Region
Write SQL to Find the region which has the largest number
of people with Tshirt size=3
Answer Posted / sitaram karancheti
In Oracle:
SELECT COUNT(table1.emp_id), region
FROM table1, table2
WHERE tshirt_size = 3 AND table1.emp_id = Table2.emp_id
AND rownum < 2
GROUP BY region
ORDER BY COUNT(table1.emp_id) DESC
In MySql:
SELECT COUNT(table1.emp_id), region
FROM table1, table2
WHERE tshirt_size = 3 AND table1.emp_id = Table2.emp_id
GROUP BY region
ORDER BY COUNT(table1.emp_id) DESC LIMIT 1
| Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
Can we use custom code in ssrs?
What do you do in data exploration
Explain what is dbcc?
What is database mirroring?
What is @@error in sql?
What is a dataset and what are the different types of datasets?
The external application that is executed in one of the tasks does not have a log file, but only a screen log. How can I save the data from the screen? : sql server management studio
How to add additional conditions in SQL?
How to Insert multiple rows with a single insert statement?
Explain about thread and memory management process of SQL?
How to disable a login name in ms sql server?
Explain contrast amongst grouped and non-bunched records?
What are different types of join?
List types of tables in SQL Azure?
What is difference between views and stored procedures?