Hello Friends! Welcome to Gate Smashers So the topic is Transactions Transaction is actually what It is a set of operations Used to perform A logical unit of work This is a definition of Transaction But as we listen transaction word What is the first thing that comes into our mind? Transaction Give and take money Means we are transferring money from here and there We are withdrawing Debit or credit Yes That is the basic meaning of transaction But it is not the only meaning of transaction Any transaction We are changing anything in database We are reading database That is also a part of transaction But the main motive of what is transaction Yes It is monetary transaction Means we want to transfer money from one account to another account Or I want to withdraw money Or I want to credit the amount That is the basic meaning of transaction But whenever we perform any transaction Why do we perform transaction Basically what we have to do We have to get some work done That only I have written over here It is set of operation Used to perform A logical unit of work Work means, task We have to perform task We will do a simple example of transaction Which almost all of you have faced That is a transaction from a ATM When we withdraw money from ATM It is a transaction What is written at last? Your transaction is completed successfully Means, what we have done Whenever we withdraw money from ATM, we have to perform set of operations And what is my task? What is my work? Over there what is my work? what is my task? Withdraw Withdraw money This is my task But, to perform this task I will have to perform some set of operations What are that set of operations? First of all I inserted the card So I inserted the card Then what is happening at backend? The information That is being read My details corresponding to my card That machine is reading So that from my account It can fetch the information That how much balance is there in the account Is this person authentic? Or not So after that what do we write I choose a language After choosing the language We generally select the account That from saving account or current account or what Generally saving account After saving account next it comes that how much money you want to withdraw That money I entered After that It asks me pin So I entered 4 digit pin And then wait for the money After that money Comes from the machine And your transaction is completed And you will get message on your registered mobile number So these 7-8 operations that we have performed What is this 7-8 operations collection called? Transaction But it is not necessary that whatever you are doing from ATM is only transaction Even if online If you are transferring money online from one account to another That is also a type of transaction For that also there are some set of operations What? first of all Authentication You on the browser You filled SBI online You filled username and password What is the first operation? You have to authenticate, that you are valid or not So as it will come to know that username and password is matched So server said that yes Now you can do the transaction Then you selected the beneficiary Then after that if beneficiary is already added Then it is good otherwise you will add And after that you will fill the amount to be transferred After that OTP will come And you will fill transaction password And your money Transaction will be successfully completed So what is the actually meaning of transaction? When we are performing set of operations And what will happen with that? Work, some work will be done So if we talk about database In database we generally What are we telling transaction? That we are generally How are we defining transaction Transaction generally represent a change in database To make some change in database What do we perform Transaction And all the banking systems are there If we are taking monterrey examples Then what these banks have done They have made database They have a database of all the account holders Where our information, detail, how much money is there Whole amount, everything is there Whenever we will do transaction What will happen at first That information will be fetched from there And then we will perform some change in that So in transaction If we talk about operations Which are the operations So in database the transaction that is there In that there are 2 operations Read and write These are 2 operations The major operations Which comes in the Transaction Read and Write Read means We have to read database Where is the data? Where is data and table? In hard disk In servers At backend the servers that we have If I talk about database server Then in database server All the data where is it kept in backend? On drives On hard drives So user is requesting From different places User is requesting To server That I want to read the data Over here there is all the data kept All the account holders data is over here So as user Uses an API an application Will access server It will request server That I want to perform particular transaction Let's say I want to transfer I want to transfer amount If I want to transfer amount from account A to account B Then first of all I should know the information of account A That much money are there in account A Who is actually owner of account A So for that first of all we send request to server That is when we fill our username password That is a kind of request to server When username password is authenticated An interface will be open in front of me What we do in that interface, we transfer As we transferred Our information is read What is read? We are reading the information from database Only, read Access, which we call as we are accessing database When we will access database After that only we can perform some write What is the meaning of write Change What is the meaning of write? change What is the meaning of read Just accessing the data We just have to see the data But the meaning of write is to make some change in the data So if we write a normal transaction in database How we will write the transaction What is the way of writing that First of all Read We are transferring database from account A to account B So first of all We will perform read Of A What is A? account So we read account A From where this read will happen? From hard disk The hard disk that is there on the backend From there the data is read first of all And after reading where will the data come? In faster memory Let's say it will come into the RAM As the data came into the RAM What data came let's say in A There are 1000 rupees And in B There are 2000 rupees So as we have done read of A So what value came in A? 1000 Now operation What operation is to be performed? Let's say from A I want to transfer 500/- in B So I am performing an arithmetic operation over here A =A-500 simple Means From A account deduct 500/- This is Arithmetic operation But when this operation will be performed Where is this operation being performed? In RAM So we also have to change that value So to change that We have to write Means we have changed the value in RAM We did write of A What is the value A over here? 500 Because we have deducted 500 from 1000 So now what is the value of A 500 But remember not in the database Still we have not done anything in the database Still in database there is the same value Where is this work going on? In RAM We did read of A and got the value 1000 A=A-500 It is an ALU arithmetic operation We performed, we did write of A Write of A means Now that value has changed to 500 Value of A has changed to 500 But where? Still in RAM only Now we will read the value of B We read the value of B account So from where this value will be read? From database From backend, from database we read the value What did it came? 2000 Now what we have to perform in this 2000? Plus, B=B+500 What is the meaning of B=B+500? That what is the value of B 2000 that had came 2500 But to do that I will have to write of B is to be done As we did write of B What happened over here? As we did write of B Value of B is updated to 500 But, still remember It had not happened in database This work is just going on in RAM Because where does CPU always perform? In RAM We discuss this thing very carefully in Operating System also That when a program Is in a Hard disk Whenever we want to execute that program When we want to execute the instructions written in that program Then first bring that program in RAM Or bring it into cache In cache memory When it will come in cache Program is converted into process Now CPU will work on it CPU never directly works on hard disk Due to speed factor Because CPU works very fast And hard disk very slow So in between we have put RAM memory Which is compatible in speed So over here in RAM what work is going on First value of A is read Changed it, then read the value of B And changed it Now what is the value of A 500 What is the value of B 2500 Over here 2500 Because write of B means B=B+500 What is the value of B? 2000 So 2000+500=2500 And at last what we are using Commit This is the 3rd operation Other than read and write We use a operation Commit What is the meaning of commit Whatever changes Whatever changes we have performed on RAM All that changes Save permanently In hard disk Now what will be the value in hard disk 500 of A And 2500 of B So this is what? a way of writing a transaction Whatever transactions we will write in database In that we are performing major 2 operations only One is read One is write But other than read and write also there are other operations like commit Rollback is there When they will come we will see them also slowly But you should know this 2 operations What does read and write do Read means just to access database To fetch the database And write means to change something in it Any change We want to perform arithmetic change in it So this is how We define a transaction And after that in transaction There are many transaction state Which are the states of transactions Properties are there Which we will discuss one by one This is all about the basic of transaction Thank you