what is the maximum width that can be assigned to a date column? This is a topic that many people are looking for. amritsang.org is a channel providing useful information about learning, life, digital marketing and online courses …. it will help you have an overview and solid multi-faceted knowledge . Today, amritsang.org would like to introduce to you Oracle SQL Tutorial – Date column in where condition. Following along are instructions in the video below:
This video. Well see how to use date columns in wire conditions using to to date and to car functions. This is for beginners.
So the scenarios that we be seeing in this video is retrieving rows or records for a given date date range month for a given month. I want all records for a specific year and how we are going to achieve this using to date and to care functions. So lets see employees stable.
An employee stable right you do have a column called hire date column. We will be using this column right well be applying the filter condition in this column to retrieve the records. So lets say right if you see i have three employees who are hired on the same day that is on 7th june.
So if i have a specific query right i want to retrieve rose for a specific date. How i can write this i can say select star from employees. Where higher and the score date equal to i have to use the function to date.
I am. Giving the literal here that is the cement june 7th. 6.
2002. And then the format here is dd dd mm yyy case. Doesnt matter here.
So you can use either upper case or lower case for the ddm. My way it doesnt matter right so let me copy and paste this and let me run. It with lower case also and show you ways since its number case doesnt matter.
Thats the thing bd sorry bd mm yyy right so let me run this so now im able to retrieve all the records for a given date right so how we can leave the farm at right here. I have set 7 june for june. I have given 0 6.
If you want to give that in months. We can give it in months or so and see the format. Im will use for that is instead of 6.
I can say j caps. Un. Then similarly.
What we have to change. Here. Is i have to say mo n.
Yy. Yy and then run the sequel right so this is retrieving records for a given date. If i want to retrieve record for a date range next question is right i want to this we have retrieved it for a given date if its for a date range.
Whats the sequel. We will use lets see hmm let me again than the original sequel. If you see in the month of august.
We have two employees right. But for two different dates. So i can give the date something like select star from employees.
Where hire date between and then i can say let me so now i am going to use the lower case just to highlight that we can do it both with a lower case and upper case. So i will say lets say. 15 16.
8. Mm. Right didi mm yy way between this state and copy and paste.
This theyll say 17th yet i get both the dates as i said in the earlier video.

We dont store the time components so im not bothered about i just came happy with just the exact date match here when we say time component. When we created records. The hire date we dont store the hire date with the time component.
We store only the days. So the next is right for a given month. I want right for a given month.
I want so all employees lets say let me see right i want all employees who are hired in the month of june right i want all employees hired in the month of june. But without any here. I am not interested in the air employees hired in the month of june.
So now we will see how we can use the to care function and get this information. So. What i will do is i will say select star from employees.
Where to care of higher. Underscore date. I am converting this hire date into a month format.
And then i will say right june let me see whether i am able to get it yeah. No records are fetched. Why no records are fetched because when i used to karen month.
It gets converted into a fixed set length. I can use trim on top of this or i can just give the format mo n. And then i can say june.
Ju. N. Now if we see it will work.
So. I am getting all employees for the month of june 17. 6.
2003. 5 4. In the month of june.
All the records erased of the day now going back why he didnt work in the earlier scenario. So the next question is right why he didnt work in this scenario. A month june.
It should work because when i used to care hire date of month. It appends the space after the month. So we have to trim it once i trim it right trim is removing the extra space right so now you get all their cuts.
So the next question right. This is an extension of what this term does trim basically removes the additional space right so the month of june. We got it so similarly if i want it for a specific year.
What we can do i want to all employees hired and 2007 or 2006. Here. I will say simply took care of yyy and then i will say to 0.
06. So now i get all employees who are hired right in year 2006. So we get all empires.
Who are hired in 2006. So basically this is how we will go about using the filters in the date fields the only additional sinawe. We have to see us right where i stored the date with time component and then if i want to retrieve all the records.
Thats for another video thank you .

Thank you for watching all the articles on the topic Oracle SQL Tutorial – Date column in where condition. All shares of amritsang.org are very good. We hope you are satisfied with the article. For any questions, please leave a comment below. Hopefully you guys support our website even more.