SQL SERVER INTERVIEW QUESTION AND ANSWERS PART 1
SQL Server Query Interview Questions with Answers SQL Server DATEADD() Function 1) Write a Query to display the date after 15 days? SELECT DATEADD(dd, 15,getdate()) 2) Write a Query to display the date after 12 months? SELECT DATEADD(mm, 2, getdate()) 2) Write a Query to display the date before 15 days? SELECT DATEADD(dd, -15, getdate()) SQL Server DATEDIFF() Function 3) Write a Query to display employee details along with exp? SELECT * DATEDIFF(yy, doj, getdate()) AS ‘Exp’ FROM employee 4) Write a Query to display employee details who is working in ECE department & who his having more than 3 years of exp? SELECT * DATEDIFF(yy, doj, getdate()) AS ‘Exp’ FROM employee WHERE DATEDIFF(yy, doj, getdate())>3 AND dept_name=’ECE’ 5) Write a Query to display employee details along with age? SELECT * DATEDIFF(yy, dob, getdate()) AS ‘Age’ FROM employee 6) Write a Query to display employee details whose age >18? SELECT * DATEDIFF(yy, dob, getdate()) AS ‘Age’ FROM em...