Writing my articles after a very long break. Tied up with lot of activities with my company KaaShiv InfoTech. Met lot of people, new environment, New friends, New Technological ideas.... lots of new things happening around me.
I feel like, I've missed out something even I was tied up with lot of activities that's nothing but my technological updates. I've decided to start my articles in this blog Hope it will go a long way from now. Let's see.
As we are familiar with "Select" clause. Here is the logical order the query will be processed in the Select clause
1. FROM
2. WHERE
3. GROUP BY
4. HAVING
5. SELECT
6. ORDER BY
2. WHERE
3. GROUP BY
4. HAVING
5. SELECT
6. ORDER BY
Example Query:
FROM Venkat_EmployeeTable
WHERE custid = 1071
GROUP BY empName, YEAR(orderdate)
HAVING COUNT(*) > 10
SELECT empiName YEAR(orderdate) AS orderyear, COUNT(*) AS numorders
ORDER BY empid, orderyear
WHERE custid = 1071
GROUP BY empName, YEAR(orderdate)
HAVING COUNT(*) > 10
SELECT empiName YEAR(orderdate) AS orderyear, COUNT(*) AS numorders
ORDER BY empid, orderyear
Cheers,
Venkatesan Prabu .J
No comments:
Post a Comment