Learn how to compare two MySQL tables row-by-row using JOINs and dynamic SQL to identify field-level differences efficiently.
To check row level differences between two records from two different tables in MySQL, where you want to see which fields have changed, follow these steps:
Using JOIN with CASE to Identify Row Level Differences in MySQL
You can compare each column individually to check row level difference and mark which ones have changed using this MySQL query.
SELECT a.id, CASE WHEN a.column1 = b.column1 THEN 'No Change' ELSE 'Changed' END AS column1_diff, CASE WHEN a.column2 = b.column2 THEN 'No Change' ELSE 'Changed' END AS column2_diff, CASE WHEN a.column3 = b.column3 THEN 'No Change' ELSE 'Changed' END AS column3_diff FROM table1 a JOIN table2 b ON a.id = b.id;
You can add as many columns as you want.
What this does:
Compares each field individually.
Marks "Changed" if different, otherwise "No Change".
If you have many columns and don’t want to manually compare each, you can generate a query dynamically using MySQL Information Schema:
SELECT CONCAT(
'SELECT id, ',
GROUP_CONCAT(
'CASE WHEN t1.', COLUMN_NAME, ' <> t2.', COLUMN_NAME,
' THEN "', COLUMN_NAME, ' changed" ELSE "No Change" END AS ', COLUMN_NAME SEPARATOR ', '
),
' FROM table1 t1 JOIN table2 t2 ON t1.id = t2.id'
) AS query_text
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'table1' AND COLUMN_NAME != 'id';
This will generate a query that automatically checks differences for all columns. Execute the generated query and you will get the differences, where all cells are marked with "Changed" or "No Change".
Conclusion
These queries can help you identify difference between two tables cell by cell. It can be useful in many ways and reduce your so much time to identify a small difference in large data.
Do you stuck with any such problem? You can write me in the comments.
Disclaimer: This post contains affiliate links. If you use these links to buy something, I may earn a commission at no extra cost to you.
Looking for the best Linux distro for an old PCs? Discover 7 lightweight Linux distributions perfect for reviving aging hardware in 2025.
Lightweight linux distros are popular due to number of benefits it offers. But, which could be the best choice for your old PC and run smoother with your old PC configuration?
In this blog, we’ll discuss various aspects of lightweight distros, some of the top lightwight linux distros and use cases and applications, which can help you to choose best for your old PC.
Why Use a Lightweight Linux Distro?
Lightweight linux distros offers flexibility, efficiency and versatility with minimum resources. Here are few points to consider,
Performance benefits for old hardware
These distributions are often used for reviving older hardware or make your older PC live again because it provides very good performance even on older hardwares.
Power efficiency and minimal resource usage
These distributions require very less resources like they can run on 512MB of RAM on Pentium II processor. Their power consumption is also very low compared to modern distros.
In this blog, we will discuss top 7 lightweight distros for old PCs in 2025. Here is the overview of these distros.
Puppy Linux
Puppy Linux is a unique family of Linux distributions specifically meant for the personal computers created by Barry Kauler in 2003.
It has some unique advantages as follows,
Ready to use: all commonly used tools are already included. So, you can start right after installing it.
Ease of use: lots of helps & hints are included to make it easy to use for even a beginner.
Relatively small size: It will take typically 500 MB or less.
Fast and versatile.
Customisable within minutes: You can make all your customizations and save them as remasters. So, whenever you want to reset your PC, you can use that remaster with all your configurations intact.
Different flavours: It is optimised to support both older & newer computers.
Variety: It has hundreds of derivatives called them as “puplets”, one of which will surely meet your needs.
What to upgrade your Old PC? Install SSD for the better performance: https://amzn.to/45eWAl8
Lubuntu
Lubuntu is a fast and lightweight operating system built on Linux system with a clean and easy-to-use UI/UX. It required very low hardware resources, because it uses the minimal desktop LXDE/LXQT, and a selection of light applications. Lubuntu was founded by Mario Behling and has been grown for many years by Julien Lavergne.
You can use Lubuntu operating system for the your latest systems as well as for lower resource computers and older systems.
Linux Lite is free operating system for everyone. It is easy to use, and suitable for beginner users Linux as it offers a lot of beginner friendly documentation. Due to it’s low requirement of resources, it is also famous amongs the people who want a lightweight environment that is also fully functional. This distribution is easy to set up and use. It provides a great balance of speed, user friendliness, features and stability. Linux Lite was created to make the transition from Windows to a linux based operating system, as smooth as possible.
antiX is a fast, lightweight and easy to install systemd-free linux distribution. It is based on Debian Stable for Intel-AMD x86 compatible systems. antiX offers users an environment suitable for old as well as new computers. So don’t throw away that old computer yet!
The goal of antiX is to provide a lightweight, but fully functional and flexible free operating system, which can be useful for both beginners and experienced users of Linux. It can run on any old PC with as low as 256MB RAM with pre-configured swap. 512MB RAM is the recommended minimum requirement for antiX and installation to hard drive requires a minimum 7.0GB hard disk space.
antiX is available in 64 bit (computers built in the last 10 years) or 32 bit (very old computers or newer machines but be aware that a lot of software no longer provides 32 bit versions).
Bodhi Linux 7.0.0 is the lightweight Linux Distribution built on top of Ubuntu LTS (22.04) featuring the Moksha Desktop. It is known for minimalism, resource efficiency, and user choice. The team behind Bodhi Linux works to make the distribution as lean as possible and believes that the end-user should be able to choose the applications that they want rather than have a bunch of pre-installed applications that are unnecessary or unwanted.
MX Linux has different flavours for different type of requirements.
MX Linux – KDE, which provides wide range of advanced applications and require high resources. It can run on newer 64-bit computers.
MX Linux – XFCE, which requires mid-weight resource, but it can run on older PCs as well as newer 64-bit computers.
MX Linux – Fluxbox, which reauires light weight resources and can run on any older PC as well as newer computers.
The MX Linux – Fluxbox can provide high speed performance using low resources. It is lightweight and fully functional system that has many unique features:
Extended hardware support by virtue of low graphical requirements.
Restricted base default package set gives the user easy control over components.
Many unique apps ease and enliven user experience.
Native dock and icon management tools join the tint2 panel for desktop customization.
Tiny Core is designed to run from a RAM copy created at boot time. Besides being fast, this protects system files from changes and ensures a pristine system on every reboot.
Very Small. It required 10MB of RAM, which is 1/400 to 1/100 the size. So, It is flexible enough to be stored and run from usb sticks, a full CD, or even embedded devices.
Linux. Tiny Core uses the Linux Kernel and a set of command-line (text interface) tools including busybox.
A GUI Desktop. Tiny Core has a flexible and fully-customizable Graphical User Interface Desktop. You can also quickly install and try out a variety of other desktops and interfaces.
Unusually Stable. Tiny Core uses program ‘extensions’ to avoid damage to the system files. These extensions are re-prepared at each reboot … and they are prepared fast.
Unusually Fast. Unlike most operating systems, the Tiny Core can run completely from RAM. Tiny Core can run in 48 megabytes of RAM … or less.
Internet ready. Tiny Core almost always finds your network card right away. You’ll be adding applications and tools after an unusually quick boot.
Available even smaller. Linophiles that get things done without a GUI can get the MicroCore, a version of Tiny Core without X that is under 7 MB.
We have discussed top 7 lightweight linux distros, you can use for your older PC to make them alive again. All of them are unique with their different set of advantages and it is difficult to choose anyone randomly. So, my suggestion is to check all the linux distros and their recommonded requirements to run. Compare these requirements with your computer requirement and choose accordingly. I installed Bodhi Linux for my 10 years old laptop and it is running very smoothly.
Frequently Asked Questions (FAQ)
What is the lightest Linux distro for old PCs?
Tiny Core Linux is one of the lightest Linux distros, with an ISO under 20MB and minimal system requirements.
Can I use Linux on a PC with 1GB RAM?
Yes, distros like Puppy Linux, antiX, and Lubuntu are designed to run smoothly on systems with as little as 512MB–1GB of RAM.
Is Linux better than Windows for old PCs?
Yes, Linux is often more efficient and secure for older hardware compared to Windows, especially when using lightweight distros.
Disclaimer: This post contains affiliate links. If you use these links to buy something, I may earn a commission at no extra cost to you.
Discover git commands to delete local branches that have been removed from remote or merged into the main branch.
Over time, your local git branches list can become overwhelming, particularly if you develop on a single branch, generate a pull request, merge it into the main branch, and then remove the remote git branch once it has been merged. After the branch is removed from the remote repository, there is no need to keep it on your local machine.
The following git command will delete all local branches that have been merged into the main branch. If your git trunk branch is not named main or you wish to remove all branches that have been merged into a branch other than main, simply modify the two instances of the word main in the command to reflect the name of your branch.
List of git commands to remove local merged git branches
To remove all the local branches, which are merged into the main branch, navigate to the root of the repository and run the following git commands,
Fetch the latest updates from the git repository
git fetch
See the list of local branches available in the repository
git branch
Delete all local branches that have been merged to main branch
This command is a combination of several Git commands and shell commands that work together to delete all the local Git branches that have been merged into the main branch, except for the main branch itself.
Here’s a breakdown of the individual commands and what they do:
git branch --merged main: This command lists all the local branches that have been merged into the main branch. The --merged option tells Git to only list branches that have been fully merged into main.
grep -v "^\* main": This command filters out the main branch from the list of branches. The -v option tells grep to invert the match, i.e., show only the lines that do not match the pattern. The pattern in this case is "^\* main", which matches lines that start with an asterisk (\*) followed by the text main.
xargs -n 1 -r git branch -d: This command passes the list of merged branches (excluding main) to the git branch -d command, which deletes each branch. The -n 1 option tells xargs to pass one branch name at a time to the git branch -d command. The -r option tells xargs to only run the git branch -d command if there is at least one branch name to pass to it. The -d option tells Git to delete the branches, but only if they have been fully merged into the current branch (in this case, main). Note that this option will fail if the branch has unmerged changes, in which case the -D option could be used instead to force-delete the branch.
This command is a combination of several commands in a shell pipeline that work together to delete Git branches that are marked as "gone".
Here’s a breakdown of the individual commands and what they do:
git branch -vv: This command lists all the Git branches in the local repository, with additional information about their upstream branches (if any). The -vv option adds more information about whether each branch is “up to date”, “behind”, or “ahead” of its upstream branch.
grep ': gone]': This command filters the output of the git branch -vv command to only show the branches that are marked as "gone". The grep command searches for lines that contain the text ": gone]", which indicates that a branch is gone.
grep -v '\*': This command further filters the output to exclude any branches that are currently checked out (indicated by the asterisk symbol). The -v option tells grep to invert the match, i.e., show only the lines that do not contain an asterisk.
awk '{ print $1; }': This command extracts only the branch names from the filtered output. The awk command splits each line of input into fields and prints only the first field, which is the branch name.
xargs -r git branch -d: This command passes the branch names to the git branch -d command, which deletes each branch. The -r option tells xargs to only run the git branch -d command if there is at least one branch name to pass to it. The -d option tells Git to delete the branches. Note that this option will fail if the branch has unmerged changes, in which case the -D option could be used instead to force-delete the branch.
Note: you can test these git commands by creating temporary repository on any git platform like, GitHub, GitLab or Bitbucket.
Disclaimer: This post contains affiliate links. If you use these links to buy something, I may earn a commission at no extra cost to you.
Understand accessors and mutators with real-world examples. Learn how to format and modify model data automatically.
In object‑oriented programming, accessors (also known as getters) and mutators (also known as setters) are public methods whose only job is to retrieve or update the value of a class member variable.
Why not use public variables directly?
While it’s technically easier to declare member variables as public, using getters and setters brings major advantages in terms of:
Encapsulation: Data and the methods that operate on it are bundled, and implementation details remain hidden from external code. This separation makes the internal workings of a class changeable without breaking external usage.
Data validation: Setters allow you to enforce rules before updating a value—for instance, preventing setting a value outside an acceptable range.
Naming Conventions
Getter: getVariableName() — returns the value of a private variable.
Setter: setVariableName(newValue) — modifies the value, optionally with validation logic.
Examples
This example shows how getters and setters can be used in Java.
public class Account {
private int balance;
public int getBalance() {
return balance;
}
public void setBalance(int newBalance) {
if (newBalance >= 0) {
balance = newBalance;
}
}
}
Similarly, this example shows usage og getters and setters using Python.
class Person:
def __init__(self, name):
self.__name = name
@property
def name(self):
return self.__name
@name.setter
def name(self, new_name):
if new_name:
self.__name = new_name
In this Python example, the @property decorator defines an accessor, while the @name.setter decorator defines a mutator.
Same accessors and mutators can be defined in other languages as well like PHP, Ruby, C#, etc.
Why Use Accessors/Mutators?
Better Encapsulation: Clients of your class interact through methods, not direct access to data.
Safe Updates: Setters can catch invalid data before it gets saved (e.g., negative numbers, abusive inputs).
Maintain Interface Stability: You can refactor or change internal data structures later without affecting external callers.
Customization & Control: Getters can return derived values, or trigger lazy computation; Setters can log events, enforce thread safety, etc.
Community Insight
In everyday developer conversations—such as on forums or Stack Overflow—it’s common to see that “accessor” = getter and “mutator” = setter. Many fall back to the more familiar terms “getters and setters,” and treat them interchangeably.
Conclusion
Accessors and mutators are foundational to good object‑oriented design. They help you build robust, maintainable, and secure classes. Instead of exposing variables directly, these methods provide controlled interaction with internal data, enforcing rules, maintaining invariants, and preserving encapsulation.
Scaling of images can be achieved without using any scripts/extensions, but to export all images as separate image files, we need to install a plugin in GIMP named ‘Export Layers’.
You can download this plugin from the following link,
This plugin is available for Windows, Linux, and macOS. For Windows, it can be installed using an executable file.
After installation of this plugin, restart GIMP.
Now, that we have the plugin installed, there is a very simple way to accomplish this task using the following easy steps.
File > Open as layers to select all images to perform a specific task (This is one single action since the file selector allows the selection of multiple images)
Image > Scale image to 75×75 to scale all layers together (We can perform many different actions similar to scaling like transforming, resizing, cropping, etc.)
File > Export Layers will open a dialog that appears allows you to choose the output folder and file extension.
Export Layers Dialog Box
The above steps will save all your image layers to separate files. This could reduce so many steps of similar tasks.
You can perform many different actions like transforming, cropping, resizing, etc. using same steps.