SQL Tutorial | Date Functions | Find Age from Birth Date

preview_player
Показать описание
This video tutorial discusses the following date functions -
1) getdate
2) datediff
3) dateadd
4) Example to find age from Birth date.

SQL Query Interview Questions Playlist

Get USD 100 off Coursera Plus Annual Subscription

Get 50% off Skillshare Annual Subscription with code AFF50.
Dates: 11/24 at midnight - 11/28 at midnight

Best Data Science / Analytics / SQL courses
Learn SQL Basics for Data Science Specialization

Beginners to Python Programming

Data Science and Business Analytics with Python

Data Science Fundamentals with Python and SQL Specialization

Python for Everybody Specialization

Google Data Analytics Professional Certificate

Coursera Plus - Data Science Career Skills

Please do not forget to like, subscribe and share.

For enrolling and enquiries, please contact us at
Рекомендации по теме
Комментарии
Автор

Register at the below link to get US $100 off for Coursera Plus membership between Sep 8 - Sep 29, 2022.
The Coursera Plus membership gets you access to unlimited courses and unlimited certifications!

LearnatKnowstar
Автор

Thank you for this tutorial. How do I then add this age column to my table permanently?

DamienOhTomation
Автор

Or try
Floor((sysdate-DOB)/365.24)
If u get Invalid identifier error for datediff function

bhuvaneshs.k
Автор

Hi could plz provide the dataset by the help I can crate the same kind of table in my laptop for practice or tell any source from which I can do the the same for each and every video because it difficult to me to create the same kind of data for each video

ANUJSHARMA-zvje
Автор

hello i am the beginner sql learner on your channel. i continuously watching your videos.
I have one suggestion for this video that we can also perform this operation by this sql command, please give me your suggestion.
select *, (DATEDIFF(DAY, DOB, GETDATE()))/365 as Age from Employee

Ashutoshsingh-cwwf
Автор

Hi. Thank you so much for the video. I have a question that's asking for 'How many more years to retirement age if the age is 65. I have calculated the age but I'm unsure how to calculate the retirement age. Thank you

roselynnehanda
Автор

Such a nice explanation, thanks a lot mam!

tathagatadas
Автор

Thank you for this tutorial. Subscribing asap.

HayKay_
Автор

Really well explained tutorial on getting max ages! however, if i want to display just the the oldest age (or youngest) based on date of birth, what would be the code?

miteshmakwana
Автор

getting error that the birthdate value is not appropriate for date add function....for argument increment integer

MrTo
Автор

Thanks for the tutorial.

But I'd wanna know how I could get the average of the ages we calculated; I'm finding it difficult to use avg() in there

vanessmensah
Автор

Please help me sir
I have to age something like this. Example:
5 years 1 day = 6 years,
5 years 11 months 30 days = 6 years.
If one day goes up, then the year should change. Plz sir

I am not getting done with this formula
Age: DateDiff("yyyy", [DOB], Now())+Int(Format(Now(), "mmdd")<Format([DOB], "mmdd"))

TheSmartComputer
Автор

Hi, thanks for the video I am an newbie however i noticed that the command TIMESTAMPDIFF(YEAR, BIRTH_DATE, CURDATE()) AS AGE also works:edit: sorry that is a mysql function it seems however its simple less typing..!

ranasanyal
Автор

How to do this using CTE, but not need of user defined function??

ravindrabisht
Автор

Can you please give the table data to practice

Ashokkumar-lfty
Автор

does this work on sql developer too in oracle?

sharvenhubbard
Автор

how do I add the age column in the main table ?

achuthakannan
Автор

Select [Order Date],
case
when MONTH([Order Date]) > month(GETDATE()) then DATEDIFF(YEAR, [Order Date], GETDATE())
when month([Order Date]) <= month(getdate()) then DATEDIFF(YEAR, [Order Date], GETDATE()) -1
end as 'Right diff'
FROM Orders$



--Hi everyone, I have tried to create the same query based on the diff. using a different dataset but with same aspect.
Can any tell if it works the same, cause i can see the output is same as described by mam in above video.

sachingulati
Автор

how to solve the Zero coming condition of the difference of date

sabnakadert
Автор

Plz share sql script to practice along

jaitiwari