1
00:00:00,330 --> 00:00:01,230
Hello, dear friends.

2
00:00:02,210 --> 00:00:07,940
So in this section, we will learn about Ezekial transaction to manage transactions.

3
00:00:07,970 --> 00:00:13,190
We're going to use three commands roll back command, commit command.

4
00:00:13,550 --> 00:00:16,910
And lastly, the Save Point Command.

5
00:00:17,780 --> 00:00:22,100
Our transaction is a unit of work that is performed against a database.

6
00:00:23,080 --> 00:00:28,390
Transactions or units or sequences of work accomplished in a logical order.

7
00:00:29,240 --> 00:00:35,060
Whether in a manual fashion by a user or automatically by some sort of database program.

8
00:00:36,610 --> 00:00:44,620
A transaction is the propagation of one or more changes to the database, for example, if you're creating

9
00:00:44,620 --> 00:00:52,060
a record or updating a record or the leading a record from the table, then you are performing a transaction

10
00:00:52,060 --> 00:00:52,840
on that table.

11
00:00:53,380 --> 00:01:00,130
So logically, it's important to be able to control these transactions in order to ensure the data integrity

12
00:01:00,580 --> 00:01:03,430
as well as to handle database errors.

13
00:01:03,640 --> 00:01:10,570
Practically, you will club many actual queries into a group and you will execute all of them together

14
00:01:10,570 --> 00:01:12,190
as part of a transaction.

15
00:01:13,620 --> 00:01:18,870
All right, so let's assume that you have an account with a thousand dollar balance at a bank and you

16
00:01:18,870 --> 00:01:22,640
want to buy a product on the Internet with your phone, is that's what you.

17
00:01:24,680 --> 00:01:26,330
If the process fails.

18
00:01:28,010 --> 00:01:31,790
As soon as you accepted, the bank will not decrease your balance.

19
00:01:34,630 --> 00:01:42,070
Unlike it would wait until the process has been completed, so the bank decreases your balance as soon

20
00:01:42,070 --> 00:01:48,790
as you accept the sale and if something goes wrong with paying to the website or whatever, then even

21
00:01:48,790 --> 00:01:53,280
though the bank decreases your balance, your product will not be sent to you.

22
00:01:53,300 --> 00:01:53,860
Do you understand?

23
00:01:53,890 --> 00:01:58,060
So they'll still take the money and you're not going to get nothing for it.

24
00:01:58,920 --> 00:02:02,420
Because it seems like you didn't pay on the website.

25
00:02:02,430 --> 00:02:03,900
That's what it looks like.

26
00:02:05,570 --> 00:02:08,310
No product, but lower bank balance.

27
00:02:09,110 --> 00:02:10,300
Big problem, yeah.

28
00:02:11,810 --> 00:02:16,370
So the ask all transactions are here to solve this problem.

29
00:02:18,630 --> 00:02:26,190
In general, a transaction is a single unit of work that consists of multiple related tasks that should

30
00:02:26,190 --> 00:02:30,190
succeed or fail as one atomic unit.

31
00:02:31,050 --> 00:02:31,410
All right.

32
00:02:31,710 --> 00:02:38,100
So as soon as you accept the sale, the bank will wait until the process has been fully completed.

33
00:02:38,670 --> 00:02:42,270
That way, if the process failed, the bank will cancel the process.

34
00:02:45,190 --> 00:02:51,520
If the process end successfully, the bank will accept the payment and then decrease your balance so

35
00:02:51,820 --> 00:02:54,220
you'll be able to receive your product.

36
00:02:55,450 --> 00:02:56,080
Acid.

37
00:02:57,920 --> 00:03:01,610
Now, to our understanding, the concept of the rescue server transaction.

38
00:03:03,060 --> 00:03:08,070
I can now describe to you the transaction using the four acid properties.

39
00:03:09,020 --> 00:03:19,520
Now, Acid is an acronym, not an acronym, but an acronym for Adam Midcity, Consistency.

40
00:03:20,360 --> 00:03:22,640
Isolation and durability.

41
00:03:24,470 --> 00:03:25,480
I'll explain it further.

42
00:03:26,640 --> 00:03:35,460
Adam Midcity means that the transaction will succeed as one unit if all the separate tasks succeed with

43
00:03:35,460 --> 00:03:36,090
no issue.

44
00:03:37,360 --> 00:03:43,060
And on the other hand, the failure of any single task within this transaction leads to the overall

45
00:03:43,060 --> 00:03:45,520
transaction failure and rolled back.

46
00:03:46,220 --> 00:03:52,540
So in other words, atomistic guarantees that the transaction is all or nothing.

47
00:03:54,050 --> 00:03:54,890
Consistency.

48
00:03:55,940 --> 00:04:02,750
Guarantees that the transaction will not affect the database consistency and will leave it in a valid

49
00:04:02,750 --> 00:04:10,820
state by complying with all database rules such as foreign keys and constraints defined on the columns

50
00:04:11,810 --> 00:04:16,010
and simple words, only valid data is saved.

51
00:04:19,090 --> 00:04:27,670
Isolation means that each transaction has its own boundary, it's separate from all the other currently

52
00:04:27,670 --> 00:04:33,340
executing transactions and will not be affected by these transactions operations.

53
00:04:34,530 --> 00:04:38,010
In other words, transactions don't affect each other.

54
00:04:39,740 --> 00:04:40,670
Durability.

55
00:04:44,060 --> 00:04:50,390
Durability means that the result of the committed transaction that is written permanently to the database

56
00:04:50,780 --> 00:04:57,440
will not be lost even in the case of an abnormal system, failure or termination.

57
00:04:58,600 --> 00:05:04,180
As there should be a mechanism of recovering this data that we're going to see later on in the next

58
00:05:04,180 --> 00:05:10,540
coming articles of the series, but in other words, written data will not be lost.

59
00:05:13,530 --> 00:05:14,700
Transaction state.

60
00:05:16,440 --> 00:05:19,800
The state of the transaction can be summarized as.

61
00:05:21,260 --> 00:05:25,640
The running transaction is referred to as the active transaction.

62
00:05:27,660 --> 00:05:34,110
So the transaction does not complete its execution, it's referred to as a failed transaction that is

63
00:05:34,110 --> 00:05:36,270
aborted without being committed.

64
00:05:37,370 --> 00:05:39,950
So that just means that the process will be canceled.

65
00:05:40,860 --> 00:05:47,250
The transaction that is not fully committed yet is referred to as a partially committed transaction.

66
00:05:48,190 --> 00:05:53,680
If the partially committed transaction completes its execution successfully, it will then be committed,

67
00:05:54,250 --> 00:05:57,580
otherwise it will be failed, then aborted.

68
00:05:58,300 --> 00:06:03,940
The transaction that completes its execution successfully without any error is referred to as a committed

69
00:06:04,090 --> 00:06:04,870
transaction.

70
00:06:06,190 --> 00:06:09,490
So on this situation, the process will be saved successfully.
