- How do I get Year or Month etc From Date?
Use the Extract Function
SELECT EXTRACT(MONTH FROM ORDER_DATE) ORDER_MONTH FROM ORDERS;
- Can I use aliases in where clause?
The answer is No
SELECT EXTRACT(MONTH FROM ORDER_DATE) ORDER_MONTH FROM ORDERS WHERE ORDER_MONTH = 10;--don't do this
SELECT EXTRACT(MONTH FROM ORDER_DATE) ORDER_MONTH FROM ORDERS WHERE EXTRACT(MONTH FROM ORDER_DATE) = 10;--do like this