Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
0
1
00:00:00,768 --> 00:00:02,304
Next is the age function
1
2
00:00:02,560 --> 00:00:03,584
As I told you
2
3
00:00:03,840 --> 00:00:07,680
One of the important things you will need to do on the date type data
3
4
00:00:08,448 --> 00:00:11,264
Is to find the difference between two dates
4
5
00:00:11,776 --> 00:00:17,152
so age function will return you the number of years months and days between two dates
5
6
00:00:17,920 --> 00:00:23,552
The syntax for age function is age then you specify date 1 which will be the later date
6
7
00:00:23,808 --> 00:00:25,344
that is the newer date
7
8
00:00:25,856 --> 00:00:28,672
Then the date 2 which will be the older date
8
9
00:00:29,184 --> 00:00:31,232
If you do not mentioned date 1
9
10
00:00:32,256 --> 00:00:35,072
Current date will be used as date 1
10
11
00:00:37,888 --> 00:00:44,032
If you want to find out the number of years months and days between these two dates
11
12
00:00:44,288 --> 00:00:48,640
That is how you write it select age mention date 1mention date 2
12
13
00:00:49,408 --> 00:00:55,552
If you remember in our sales table we had shipping date and order date if you want to find out the number
13
14
00:00:55,808 --> 00:00:59,136
of months or days taken between order date and ship date
14
15
00:00:59,392 --> 00:01:05,536
We will write this query where will find out the order line order date ship date and then the age between
15
16
00:01:05,792 --> 00:01:06,816
Ship date and order date
16
17
00:01:08,864 --> 00:01:10,912
Let us go and write these queries
17
18
00:01:13,728 --> 00:01:15,264
so we will select
18
19
00:01:15,520 --> 00:01:16,288
Age
19
20
00:01:18,080 --> 00:01:19,360
Between
20
21
00:01:25,504 --> 00:01:27,552
27 December 2018
21
22
00:01:28,832 --> 00:01:29,600
And
22
23
00:01:31,648 --> 00:01:33,696
say 3rd
23
24
00:01:34,208 --> 00:01:35,232
June
24
25
00:01:35,488 --> 00:01:37,024
2017
25
26
00:01:42,400 --> 00:01:43,680
You run this
26
27
00:01:45,728 --> 00:01:50,848
The difference between these two in one year 6 months and 24 days
27
28
00:01:51,616 --> 00:01:55,200
Next if you want to find out the difference between
28
29
00:01:55,456 --> 00:02:00,832
The number of days taken between order date and ship date let us write select
29
30
00:02:01,088 --> 00:02:06,976
Order line ship date
30
31
00:02:10,048 --> 00:02:10,816
Order date
31
32
00:02:15,936 --> 00:02:18,240
The age between
32
33
00:02:18,496 --> 00:02:19,520
Ship date
33
34
00:02:20,032 --> 00:02:22,592
Which will be the date one
34
35
00:02:23,104 --> 00:02:26,688
And the Order date
35
36
00:02:26,944 --> 00:02:28,224
As
36
37
00:02:28,736 --> 00:02:32,064
The time taken time taken
37
38
00:02:32,576 --> 00:02:35,136
From
38
39
00:02:35,392 --> 00:02:36,416
Sales table
39
40
00:02:36,672 --> 00:02:37,952
Ordered by
40
41
00:02:38,208 --> 00:02:39,744
The time taken
41
42
00:02:47,936 --> 00:02:48,704
let us see
42
43
00:02:57,408 --> 00:02:59,200
descending let us see
43
44
00:03:00,224 --> 00:03:00,736
So
44
45
00:03:02,784 --> 00:03:03,296
These
45
46
00:03:03,552 --> 00:03:04,832
Top orders
46
47
00:03:05,344 --> 00:03:06,880
Have taken 7 days
47
48
00:03:07,648 --> 00:03:09,696
from Order date to ship date
48
49
00:03:10,464 --> 00:03:12,512
If you go down you will find
49
50
00:03:12,768 --> 00:03:14,304
Orders which have taken
50
51
00:03:16,352 --> 00:03:22,496
Six days five days and so on till in the end probably it will be zero days
51
52
00:03:22,752 --> 00:03:27,616
for which you did the shipping on the same day as you got the orders
52
53
00:03:28,896 --> 00:03:31,456
So that's how we find out the
53
54
00:03:31,712 --> 00:03:35,040
Number of days months years between two dates
54
55
00:03:36,576 --> 00:03:39,904
Let us say if you want to extract only day part
55
56
00:03:40,160 --> 00:03:45,024
or month part of the Year part from a date how do we do that
56
57
00:03:46,048 --> 00:03:48,352
For that there is a separate function called Extract function
4310
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.