1
00:00.360 --> 00:02.640
Let's solve another problem.

2
00:03.280 --> 00:07.200
It is related to immediate food delivery percentage.

3
00:07.840 --> 00:12.000
Below is the problem statement given a table of food delivery orders.

4
00:12.560 --> 00:17.000
Calculate the percentage of orders that were immediate orders.

5
00:18.560 --> 00:24.920
An immediate order is one where the customers preferred delivery date is the same as the order date.

6
00:25.560 --> 00:26.040
Right.

7
00:26.560 --> 00:27.040
So.

8
00:29.120 --> 00:35.280
Let me ask the ChatGPT about my table structure and data.

9
00:36.440 --> 00:39.320
Let me share with the same with ChatGPT.

10
00:39.800 --> 00:41.720
So I am having the.

11
00:43.760 --> 00:48.800
Table structure and data like below.

12
00:52.480 --> 00:53.000
Okay.

13
00:53.040 --> 00:54.760
Please go ahead and share your data.

14
00:54.760 --> 00:57.760
So I am sharing my data with the ChatGPT.

15
00:58.440 --> 01:01.320
And now I am sharing my problem statement as well.

16
01:05.160 --> 01:08.530
So let me share my problem statement as well.

17
01:09.450 --> 01:14.690
And let's see what solution will provide the ChatGPT.

18
01:14.930 --> 01:15.530
Okay.

19
01:17.290 --> 01:18.610
This is the first solution.

20
01:18.610 --> 01:25.210
And they've mentioned that this solution will work for the SQL server right.

21
01:28.770 --> 01:38.570
So see now this solution and what whichever the solution has been written by us both are almost identical.

22
01:38.570 --> 01:39.090
Right.

23
01:43.370 --> 01:45.290
So we can say solution.

24
01:48.010 --> 01:48.730
By the.

25
01:50.810 --> 01:51.450
ChatGPT.

26
01:51.490 --> 01:56.090
Let's see whether any other solution provided by ChatGPT or not.

27
01:58.050 --> 01:59.250
So it hasn't provided.

28
01:59.250 --> 01:59.450
Right.

29
01:59.450 --> 02:02.170
So if you see over here whenever this.

30
02:04.890 --> 02:08.170
Order date in preferred delivery date is same.

31
02:08.170 --> 02:10.690
It means it is a immediate delivery right.

32
02:11.810 --> 02:18.870
Again for delivery ID for this order date and preferred delivery date is same.

33
02:18.870 --> 02:21.790
So we can say it is immediate delivery right?

34
02:22.110 --> 02:27.670
So out of the total six delivery two deliveries are immediate delivery right.

35
02:29.430 --> 02:36.030
So we can say let me try to do two divided by six.

36
02:36.270 --> 02:38.830
So let me okay.

37
02:38.870 --> 02:40.190
It is giving zero.

38
02:40.870 --> 02:44.710
So let me multiply it by 1.00.

39
02:45.150 --> 02:46.270
And now let's check.

40
02:48.270 --> 02:50.390
Okay 0.33 okay.

41
02:50.430 --> 02:50.870
Fine.

42
02:51.230 --> 02:54.750
Now let me try to execute both of these query okay.

43
02:54.790 --> 02:56.350
33 percentage right.

44
02:56.670 --> 03:03.230
So for this 0.33 you can do multiply by 100 right.

45
03:03.270 --> 03:05.790
And it will give 33 point.

46
03:06.230 --> 03:08.790
And also you can do round over here right.

47
03:09.070 --> 03:09.910
So round.

48
03:13.070 --> 03:13.750
Comma two.

49
03:13.790 --> 03:14.190
Right.

50
03:14.310 --> 03:20.670
So let me just copy this one and let me execute all these three query together.

51
03:23.240 --> 03:27.960
Okay, almost all three is giving the same result, right?

52
03:28.360 --> 03:31.680
So our answer is perfect.

53
03:33.720 --> 03:34.080
Right.

54
03:34.120 --> 03:36.680
We have to do two divided by six only.

55
03:36.680 --> 03:37.160
Right?

56
03:37.600 --> 03:42.080
Two means how many number of orders has order, date and customer preferred?

57
03:42.080 --> 03:43.440
Delivery date is same.

58
03:43.800 --> 03:45.840
So that we are counting over here.

59
03:45.880 --> 03:46.360
Right?

60
03:46.880 --> 03:54.000
Case when order date equal to customer preferred delivery date is same then one is zero and we are doing

61
03:54.000 --> 03:55.560
the sum of the same right.

62
03:56.080 --> 04:05.960
And we are doing the multiply by 100.0 to avoid integer division right and divided by count of delivery

63
04:05.960 --> 04:06.320
id.

64
04:06.320 --> 04:10.680
So total number of delivery id we are doing.

65
04:10.920 --> 04:13.160
We are writing it in the division part.

66
04:13.200 --> 04:13.680
Right.

67
04:13.840 --> 04:20.040
And then we are doing the rounding with the decimal point two.

68
04:20.440 --> 04:22.280
So that will be our answer right.

69
04:23.080 --> 04:26.560
So let's see the next question into the next lecture.

70
04:26.560 --> 04:27.200
Thank you.