Sunday, April 26, 2026

A Quick Guide of Database Transaction for Beginners (with Example)

 Hello guys, A database transaction is an important concept to understand while working in databases and SQL. Transaction in the database is required to protect data and keep it consistent when multiple users access the database at the same time.  In this database transaction tutorial we will learn what is a transaction in a database, why do you need transactions in the database, ACID properties of database transactions and an example of database transactions along with commit and rollback.   


Almost all vendors like Oracle, MySQL, SQL Server, or Sybase provide transaction facility but MySQL only provides it for certain storage engines like InnonDB and BDB and not for MyISAM. 

What is a transaction in the database?

database transaction tutorial example in sqlDatabase transaction is a collection of SQL queries which forms a logical one task. For a transaction to be completed successfully all SQL queries have to run successfully. 

Database transaction executes either all or none, so for example if your database transaction contains 4 SQL queries and one of them fails then change made by other 3 queries will be rolled back. 

This way your database always remain consistent whether transaction succeeded or failed. The transaction is implemented in the database using SQL keyword transaction, commit, and rollback

Commit writes the changes made by transaction into database and rollback removes temporary changes logged in transaction log by database transaction. 


Database Transaction tutorial

Why transaction is required in database

The database is used to store data required by real life application e.g. Banking, Healthcare, Finance etc. All your money stored in banks is stored in the database, all your shares of DMAT account is stored in the database and many application constantly works on these data. 

In order to protect data and keep it consistent, any changes in this data need to be done in a transaction so that even in the case of failure data remain in the previous state before the start of a transaction. 

Consider a Classical example of ATM (Automated Tailor Machine); we all use to withdraw and transfer money by using ATM. If you break withdrawal operation into individual steps you will find:

1) Verify account details.
2) Accept withdrawal request
3) Check balance
4) Update balance
4) Dispense money

Suppose your account balance is 1000$ and you make a withdrawal request of 900$. At fourth step, your balance is updated to 900$ and ATM machine stops working due to power outage.

Once power comes back and you again tried to withdraw money you surprised by seeing your balance just 100$ instead of 1000$. This is not acceptable by any person in the world :) so we need a transaction to perform such task. 

If SQL statements would have been executed inside a transaction in database balance would be either 100$ until money has been dispensed or 1000$ if money has not been dispensed.

ACID Properties of database transaction

There are four important properties of database transactions these are represented by acronym ACID and also called ACID properties or database transaction where:

A stands for Atomicity, Atom is considered to be smallest particle which can not be broken into further pieces. Database transaction has to be atomic means either all steps of transaction completes or none of them.

C stands for Consistency, transaction must leave database in consistent state even if it succeed or rollback.

I is for Isolation
Two database transactions happening at same time should not affect each other and has consistent view of database. This is achieved by using isolation levels in database.

D stands for Durability
Data has to be persisted successfully in database once transaction completed successfully and it has to be saved from power outage or other threats. This is achieved by saving data related to transaction in more than one places along with database.

When to use database transaction

Whenever any operation falls under ACID criteria you should use transactions. Many real world scenarios require transaction mostly in banking, finance and trading domain.





How to implement transaction in SQL?

Database transaction is implemented in SQL using three keywords start transaction, commit and rollback. Once you type start transaction, database starts a transaction and execute all subsequent SQL statements in transaction and keep track of all of them to either commit or rollback changes. 

Commit keywords saves then changes made by transaction into database and after commit change is normally visible to other transaction though is subject to isolation level

 In case you encountered any error while executing individual sql statements inside database transaction, you can rollback all your changes by executing "rollback" command.

Database Transaction Example

To understand database transaction better let's see a real life example of transaction in database. For this example we will assume we have an Account table which represent a Bank Account and we will transfer money from one account to another account

Request: transfer 900$ from Account 9001 to 9002

start transaction
select balance from Account where Account_Number='9001';
select balance from Account where Account_Number='9002';
update Account set balance=balance-900 here Account_Number='9001' ;
update Account set balance=balance+900 here Account_Number='9002' ;
commit; //if all sql queries succed
rollback; //if any of Sql queries failed or error


Database transaction in MySQL

In my previous MySQL command tutorials I have talked about different database storage engines available in MySQL e.g. myISAM or InnonDB. Not all MySQL engines supports transaction in order to make transaction works in MySQL you either need to use InnonDB or BDB Engine. 

You can specify engine while creating table in MySQL or you can also change your engine in MySQL by using ALTER keyword. 

For example "ALTER TABLE tablename TYPE=InnoDB;


Important point about database transaction

1. Database transaction is nothing but a set of SQL statement.

2. Transaction in database is either all or none means either all SQL statement success or none.

3. Its good practice to execute sql query inside transaction and commit or rollback based on result but you need to be little careful with transaction log. 

To facilitate rollback and commit every sql query which executed inside database transaction is written into transaction log and size of transaction log can grow significantly if don't commit or rollback for longtime.

4. Effect of two simultaneous database transaction into data is controlled by using Isolation level. Isolation level is used to separate one database transaction with other and currently there are four database isolation levels:

1) Read Uncommitted
This is the lowest level of database isolation level in this one database transaction can see changes made by other database transaction which is not yet committed. This can allow you dirty read so quite dangerous.

2) Read Committed
This is slightly better where one database transaction only sees committed changes by other database transaction. But this is also not safe and can lead you to non-repeatable reads problem.

3) Repeatable Reads

4) Serializable
The highest level of database isolation level. In this, all database transactions are totally isolated with other database transaction. Though this is safe but this safety can cause a significant performance hit.

5. MyISAM storage engine in MySQL doesn't support transaction. In order to make transaction works in MySQL use InnoDB.

6. Database transaction should follow ACID properties.

That’s all for now on database transaction tutorial, I will add more useful points about transaction in database as I come across or recall, you can also provide your input and issues face during transaction in database on different RDBMS e.g. Oracle, MySQL, MSSQL Server or Sybase etc.


Other Database Tutorials

The AI Engineer’s Reading List for 2026 (10 Books That Matter)

best books to become an AI Engineer in 2026

Hello Devs, Let’s be real — when it comes to learning AI and LLM engineering, the internet is flooded with books written to cash in on the current AI gold rush.

Most of them are either outdated, overly academic, or full of theoretical fluff that won’t help you build real-world systems.

But not all books are created equal.

There are a few that cut through the noise, written by real practitioners who have built production-ready systems and know what actually works.

These books teach you how to think like an AI engineer, not just a model tuner. They help you understand how to build, deploy, and maintain scalable, reliable, and practical AI systems — especially Large Language Models (LLMs).

These are also the must-read books on AI and LLM engineering, not just in my opinion but also from several others on Reddit and HN, as these are also the most recommended books on AI and LLM Engineering.

If you're serious about becoming an AI Engineer or mastering Large Language Models (LLMs), these are the books you should read.

Each one is practical, battle-tested, and written by people who have built production-grade AI systems—not just talked about them.

These are also good for software engineers who want to become AI engineers. These will teach you all the skills you need from Prompt Engineering to LLM to become an AI Engineer in 2026, and let me tell you, there is huge demand for AI Engineers now.

The interviews are also relatively easier, and the package people are getting is 10 to 20% more than what you get as a Software Engineer for the same level of experience.

So, it's also a good chance to switch careers from Software Engineer to AI Engineer, and these books can certainly help you.

Btw, if you are new here, then I would also like to remind you that in my last articles, I shared 10 Must Read Software Engineering Books and 10 Must Read Algorithms Books. If you haven't checked them, you can also check them after reading this article.

10 Must Read Software Engineering Books for Developers

10 Must-Read Books for AI Engineers in 2026

Without any further ado, here is a list of the 10 Best Books to Learn AI and LLM Engineering in 2026. This includes books on AI, Machine Learning, and Large Language Models.

If you're serious about becoming an AI engineer or working with LLMs, this list is your roadmap.

1. AI Engineering by Chip Huyen

This is the first book you should read on AI Engineering, and if you don't like reading many books, then this single book is enough to learn all the skills you need to become an AI Engineer in 2026.

Chip Huyen, author of this book, brings a refreshing focus on AI systems design rather than just models.

If you don't know, Chip has worked as a researcher at Netflix, was a core developer at NVIDIA (building NeMo, NVIDIA’s GenAI framework), and cofounded Claypot AI. She has also taught machine learning (ML) at Stanford University.

This book covers what an AI engineering stack looks like: the one that we software engineers must become experts in order to be an AI engineer.

You'll learn how to turn machine learning models into real products --- handling data pipelines, model versioning, deployment, monitoring, and scaling.

It also covers what AI engineering is, how it differs from ML engineering, and the techniques AI engineers should be familiar with.

If your goal is to become a true AI Engineer (not just a Kaggle competition winner), this book is pure gold.

Here is the link to get this book --- AI Engineering by Chip Huyen

best book to become an AI Engineer


2. The LLM Engineering Handbook by Paul Iusztin and Maxime Labonne

This book is like an operations manual for LLM development.

It covers prompt engineering, model fine-tuning, retrieval-augmented generation (RAG), evaluation strategies, and production patterns.

The authors have real-world experience building LLM apps at scale.

Highly recommended if you want to move from "just using GPT" to designing serious LLM applications.

Here is the link to get this book --- The LLM Engineering Handbook by Paul Iusztin and Maxime Labonne

best books to learn LLM Engineering


3. Designing Machine Learning Systems by Chip Huyen

This is another great book from Chip Huyen, one of my favorite authors when it comes to AI and LLM engineering

While "AI Engineering" focuses more on the systems side, this one gets into how to design and operate machine learning systems under real-world constraints like data drift, retraining, and model reliability.

You'll start thinking like a machine learning product engineer, not just a model builder.

Here is the link to get this book --- Designing Machine Learning Systems by Chip Huyen

best book to learn AI Engineers


4. Building LLMs for Production by Louis-François Bouchard and Louie Peters

This book shows you how to actually ship Large Language Models into production environments. You'll learn about fine-tuning, deploying, scaling, and maintaining LLMs like a real engineer.

It's packed with hands-on advice, architecture examples, and real deployment challenges.

If you're aiming for a career as an LLM engineer, this book should be your first read.

Here is the link to get this book --- Building LLMs for Production by Louis-François Bouchard and Louie Peters

best books to learn LLMs


5. Build a Large Language Model (from Scratch) by Sebastian Raschka, PhD

Sebastian Raschka is a legend in the machine learning community. This book teaches you how to build a transformer-based LLM from scratch using PyTorch, with no shortcuts.

You'll go deep into model architecture, tokenization, attention mechanisms, and training strategies.

Perfect for developers who want to understand LLMs at the code level, not just use APIs like OpenAI's.

Here is the link to get this book --- Build a Large Language Model (from Scratch) by Sebastian Raschka, PhD

best book to learn Large Language Models


6. Hands-On Large Language Models: Language Understanding and Generation

Jay Alammar and Maarten Grootendorst are two of the most respected names in the AI and NLP space.

This book walks you through building and fine-tuning large language models with modern tools like Hugging Face Transformers, LangChain, and more.

It's hands-on and practical --- ideal for developers, data scientists, and ML engineers who want to build and deploy LLMs that understand and generate human language effectively.

Here is the link to get this book --- Hands-On Large Language Models

Is Hands-On Large Language Models: Language Understanding and Generation worth it


7. Prompt Engineering for LLMs: The Art and Science of Building Large Language Model-Based Applications

If you're building AI products using OpenAI, Claude, or open-source LLMs, this book shows you how to write smarter prompts for better results.

It covers strategies like few-shot prompting, chain-of-thought, and using prompt patterns effectively.

Created by John Berryman and Albert Ziegler this book dives into the evolving art and science of prompt engineering.

A must-read for AI developers and product designers.

Here is the link to get this book --- Prompt Engineering for LLMs

best book to learn prompt engineering


8. Building Agentic AI Systems: Create Intelligent, Autonomous AI Agents that can Reason, Plan, and Adapt

Written by Anjanava Biswas and Wrick Talukdar, this book explores how to build agentic AI systems that can go beyond static outputs.

This book shows you how to create autonomous AI agents that can interact with environments, reason, make decisions, and take actions.

If you're interested in building AI agents like Auto-GPT, BabyAGI, or LangGraph-based systems, this guide is a goldmine.

Here is the link to get this book --- Building Agentic AI Systems

Is Building Agentic AI Systems book worth it


9. Prompt Engineering for Generative AI: Future-Proof Inputs for Reliable AI Outputs

This is a comprehensive guide to prompt engineering techniques specifically designed for generative AI systems --- including text, image, and code generation.

The book emphasizes how to write prompts that are robust, consistent, and tailored for business and production environments.

Whether you're working with GPT, DALL-E, or other models, this Prompt Engineering book by James Phoenix and Mike Taylor will definitely help you future-proof your AI input strategies.

Here is the link to get this book --- Prompt Engineering for Generative AI

Is Prompt Engineering for Generative AI book good


10. The AI Engineering Bible: The Complete and Up-to-Date Guide to Build, Develop and Scale Production Ready AI Systems

Thomas R. Caldwell's AI Engineering Bible is a must-have for software engineers and tech leaders.

It goes beyond models and APIs to show you how to engineer real-world AI systems that are scalable, maintainable, and production-ready.

From architecture to infrastructure, deployment to monitoring, it covers the entire AI lifecycle. This is the playbook for anyone who wants to lead AI implementation in their organization.

Here is the link to get this book --- The AI Engineering Bible

Is he AI Engineering Bible book worth it


Why You Should Read These Books?

Apart from my recommendations and several others on Reddit and HN, here are the top 5 reasons why you should read these AI and LLM Engineering books.

  1. They're written by practitioners who have built production AI/LLM systems.

  2. They focus on engineering, deployment, and real-world use cases --- not just algorithms.

  3. They don't waste your time with outdated academic theory.

  4. They prepare you for the future of AI and LLM work: scalable, reliable, explainable systems.

  5. Widely recommended by professionals on Reddit and Hacker News.

Reading books is powerful, but nothing beats building things.

If you want to accelerate your learning, combine these books with a hands-on course like: LLM Engineering: Master AI, Large Language Models & Agents to get some hands-on experience on building RAG RAG-based chatbot and learning LLM by watching.

best course to learn LLM Engineering

Conclusion

That's all about the best books to learn AI and LLM Engineering in 2026. If you're serious about mastering AI and LLM engineering in 2026 and beyond, start with these must-read AI and LLM Engineering books.

They'll save you hundreds of hours of wasted time and help you actually build systems that work.

Want even faster progress?
If you want more fun and faster progress then you can also pair these books with hands-on projects like building your own RAG-based chatbot, fine-tuning a model on your own dataset, or deploying a real-world LLM app to the cloud.

Friday, April 24, 2026

The Software Engineer's Reading List for 2026 (10 Books That Matter)

10 Must Read Software Engineering Books for Developers

Credit - ByteByteGo - https://bit.ly/3P3eqMN

Hello guys, if you have worked as a Software Engineer, Developer, or Programmer, you may know that, as software engineers, continuous learning is not just a goal—it’s a necessity.

From one task to the next, from one project to the next, there is always learning required. Many times you need to learn a new programming language or framework, or library, or coding and designing.

And, when it comes to learning, nothing beats a book.

Whether you’re looking to refine your coding practices, master system design, or gain a deeper understanding of software architecture, the right books can offer insights and techniques to elevate your skills.

I know that we learn from our experience, and books are a great way to learn from other people’s experiences.

There is a limit to how much you can learn from your own experience, but if you start learning from other folks’ experiences, then there is no limit.

And, books give a glimpse of how experts think, what understanding they have of certain topics that matter most for software engineers and developers.

In the last few articles, I have shared many popular system design questions like API Gateway vs Load Balancer and Horizontal vs Vertical ScalingForward proxy vs reverse proxy as well as 50 system design problems and today I am going to share the 10 books you can read to become a better software engineer.

This article features ten essential books every software engineer should read, divided into five categories: General AdviceCodingSoftware ArchitectureDesign Patterns, and Data Structures & Algorithms.

So what are we waiting for? Let’s start


10 Books Every Software Engineer and Developer Must Read

Without any further ado, here are the best books any Software engineer, developer, or programmer can read.

We will start with general advice for programmers and then finish with Data Structures and Algorithms, one topic that separates amateurs from professionals in the programming field.

General Advice

  1. The Pragmatic Programmer. This classic by Andrew Hunt and David Thomas provides actionable advice for software developers, from debugging techniques to career growth. It emphasizes the importance of being adaptable and continuously refining your craft.

  2. Code Complete (2nd Edition) Written by Steve McConnell, this book is often hailed as a comprehensive guide to software construction.

It provides proven practices for writing robust, maintainable code and improving your software craftsmanship. This book was first recommended to me by our tech lead, who had a tradition of giving this book to every new joiner in the company.

best coding books for developers

Coding

Now, let’s see a few coding books that every software engineer should read

  1. Clean Code 2nd Edition
    By Robert C. Martin (”Uncle Bob”), this book is a manifesto for writing readable, efficient, and maintainable code. It provides practical examples of bad code versus clean code and teaches you the mindset of a skilled programmer.

  2. Refactoring: Improving the Design of Existing Code
    This book by Martin Fowler is essential for anyone looking to improve their existing codebase without introducing new bugs. It’s a step-by-step guide to transforming bad code into good code while preserving functionality.

    Clean Code: A Handbook of Agile Software Craftsmanship

Software Architecture

  1. Designing Data-Intensive Applications 2nd Edition
    By Martin Kleppmann, this book dives deep into the systems that power modern software applications. It’s an indispensable resource for understanding distributed systems, data pipelines, and scalability.

  2. System Design Interview (Volumes 1 & 2)
    Designed to prepare you for system design interviews, these books by Alex Xu break down complex systems into simple, digestible components. They’re packed with real-world examples and diagrams to help you master system design.

Designing Data-Intensive Applications, 2nd Edition [Book]

Design Patterns

  1. Design Patterns: Elements of Reusable Object-Oriented Software
    This seminal work by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (the “Gang of Four”) introduces 23 foundational design patterns. It’s a must-read for understanding object-oriented programming and software design.

  2. Domain-Driven Design: Tackling Complexity in the Heart of Software
    By Eric Evans, this book explores techniques to handle complex business domains in software development. It emphasizes collaboration between developers and domain experts to create intuitive, effective systems.

best design pattern books for developers

Data Structures & Algorithms

  1. Introduction to Algorithms
    Known as the “CLRS book,” this comprehensive guide covers a wide range of algorithms and data structures, complete with mathematical rigor. It’s an essential resource for both beginners and seasoned developers.

  2. Cracking the Coding Interview
    By Gayle Laakmann McDowell, this book is the ultimate resource for technical interviews. It provides 189 programming questions and solutions, along with strategies to tackle them effectively.

best data structures and algorithms books for develoeprs

Why These Programming and Development Books Matter?

This is a good question: why should you read these books? There are better things you can do, like watching Squid Games season 2 on Netflix or binge-watching YouTube videos, so why should one read these books?

Well, these ten books collectively address the most critical aspects of software engineering.

From honing your coding skills and understanding architectural design to mastering data structures and algorithms, they prepare you for real-world challenges and interviews alike.

Just reading these books will expand your knowledge base, and even if you don’t get 100%, you will be a much better engineer than without reading these books.

If you ask me, I have read most of them, not page to page, but most of it, and I can say that every time I read a book, I come up with more knowledge and wisdom, even on topics that I thought I knew very well.

If you want to just read one book, start with Clean Code, one of my favorite books on coding. I learned a lot about coding as an art from this book.

It’s the one that takes you from HelloWorld programmer to a professional, well, at least it made that impact for me.

best programming books for software engineer

How to Get Started? Which Book Should You Read First

This is a difficult part, especially if you are presented with a list of 10 books.

I would suggest starting by identifying the areas where you want to improve.

If you’re aiming for cleaner code, dive into Clean Code or Refactoring: Improving the Design of Existing Code.

Preparing for interviews? Focus on “Cracking the Coding Interview” and System Design Interview (Volumes 1 & 2)

If you’re venturing into software architecture, Design Patterns: Elements of Reusable Object-Oriented Software is a must-read.

Remember, each of these books represents a treasure trove of knowledge that can transform your approach to software engineering. So pick one today and start your journey toward mastery!

All the best with your learning journey !!

Other Articles you may like