SQL Queries||TimeStampDiff and DateDiff

Published: 03 August 2023
on channel: SQLtoSSIStoPowerBI
488
4

How to calculate AGE using DOB Column in MySQL and MS-SQL Server?

DateDiff (Interval,date1,date2) - MS SQL SERVER
TimestampDiff(Interval,date1,date2) - MySQL

Getdate() - MS SQL SERVER
CurDate() - MySQL

MySQL:
SELECT Name,DOB,TIMESTAMPDIFF(YEAR,DOB,Curdate()) AS AGE FROM EMP_tbl;

MS SQL SERVER:
SELECT Name, DOB, DATEDIFF(YEAR,DOB,Getdate()) AS AGE FROM EMP_tbl


On this page of the site you can watch the video online SQL Queries||TimeStampDiff and DateDiff with a duration of hours minute second in good quality, which was uploaded by the user SQLtoSSIStoPowerBI 03 August 2023, share the link with friends and acquaintances, this video has already been watched 488 times on youtube and it was liked by 4 viewers. Enjoy your viewing!