SQL Query

%3CLINGO-SUB%20id%3D%22lingo-sub-2700791%22%20slang%3D%22en-US%22%3ESQL%20Query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2700791%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20Friends%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20query%20like%20below%20which%20is%20in%20Oracle%20syntax.%26nbsp%3B%20How%20do%20I%20write%20this%20for%20SQL%20server%3F%3C%2FP%3E%3CP%3EYour%20help%20is%20highly%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3COL%3E%3CLI%3EDisplay%20the%20first%20name%20and%20join%20date%20of%20the%20employees%20who%20joined%20between%202002%20and%202005.%3C%2FLI%3E%3C%2FOL%3E%3CP%3ESELECT%20FIRST_NAME%2C%20HIRE_DATE%20FROM%20EMPLOYEES%20WHERE%20TO_CHAR(HIRE_DATE%2C%20'YYYY')%20BETWEEN%202002%20AND%202005%20ORDER%20BY%20HIRE_DATE%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2702296%22%20slang%3D%22en-US%22%3ERe%3A%20SQL%20Query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2702296%22%20slang%3D%22en-US%22%3EThis%20board%20is%20for%20things%20related%20to%20Microsoft%20Learn%20and%20Microsoft%20Certifications.%20I%20would%20recommend%20reaching%20out%20on%20the%20SQL%20Server%20Community%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fsql-server%2Fbd-p%2FSQL_Server%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fsql-server%2Fbd-p%2FSQL_Server%3C%2FA%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello Friends

 

I have a query like below which is in Oracle syntax.  How do I write this for SQL server?

Your help is highly appreciated.

 

  1. Display the first name and join date of the employees who joined between 2002 and 2005.

SELECT FIRST_NAME, HIRE_DATE FROM EMPLOYEES WHERE TO_CHAR(HIRE_DATE, 'YYYY') BETWEEN 2002 AND 2005 ORDER BY HIRE_DATE

2 Replies
This board is for things related to Microsoft Learn and Microsoft Certifications. I would recommend reaching out on the SQL Server Community
https://techcommunity.microsoft.com/t5/sql-server/bd-p/SQL_Server
oh thanks.