In this movie, Adam introduces the DateDiff() function. DateDiff() calculates the elapsed time in a flexible variety of intervals. Using DateDiff() the database can add or subtract a specified number of days, months, or years to a starting date in order to find the exact amount of time units that have elapsed.
- [Voiceover] Now that we know how to tell Access…to return today's date and the current time,…we can use that information to help obtain…query results that are relative to today.…We have two different functions that return…slightly different results depending on the type…of question that we're trying to ask.…The first one I want to take a look at…is a function called DateDiff.…Let's a construct a new query in design view…to take a look at it.…I'm going to build this off our employees table.…I'll close the show table window…and we'll add in the employee ID and their hire date.…In the next column over, let's suggest that I want…to find how many days ago they were hired.…
Well, one way that I can do this,…we've already seen, is with some simple subtraction.…I can type in the reference to the hire date field,…just in square brackets,…and then I can subtract today's date,…which we can get with the date function.…Just type in the open parenthesis…followed immediately by a closing parenthesis.…That's going to create this new expression…
- Creating a query with the wizard
- Defining query criteria
- Using comparison and wildcards in criteria
- Working with joins
- Creating parameter queries
- Using the built-in functions in Access
- Summarizing data
- Aggregating records with totals
- Working with dates
- Creating alternative queries: unmatched, crosstab, and more
- Writing queries with SQL
Skill Level Intermediate
1. Introduction to Access Queries
2. Creating Simple Select Queries
3. Creating Parameter Queries
4. Use the Built-In Functions
5. Aggregating Records with a Totals Query
6. Working with Dates in Queries
7. Understanding Program Flow Functions
8. Alternative Query Types
9. Writing Queries with Structured Query Language
Explore the basics of SQL5m 59s
10. Useful Query Tricks
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.