← All blog posts

How to Use SQL with phpMyAdmin?

On the site of a stationery you sell notebook, pen, ruler and eraser. You find the answer of the question “which is the cheapest two products that are left in the store?” with your eyes in four lines list. You want to leave the sa

How to Use SQL with phpMyAdmin?
On the site of a stationery you sell notebook, pen, ruler and eraser. You find the answer of the question “which is the cheapest two products that are left in the store?” with your eyes in four lines list. You want to leave the same job into a query as the number of products goes out four thousand. Let's write that query on phpMyAdmin. Then when it comes to a box pencil from the same dükkâna, the stock single line without writing SQL Let’s look at how we can update with Database Manager.

Where to look at phpMyAdmin?

phpMyAdmin is a tool that allows you to work from the browser with MySQL or MariaDB database. SQL is the language you write what you want to database. If your hosting provider offers phpMy ERP, you can often open it in databases section. A trial setup on your own computer is also enough for this article. If you come from which way, choose a blank trial database from left. On top Check the name you see. The commands that you will write from a little will work in your chosen place.

Think about the table like a product book of a dükkâ. A line tells you that a product remains the name, price and how many it takes to get. You can open the book to find a product and look for. If you want to say “ bring the cheapest two products left on the floor” then your SQL makes your business easier. We will see the answer of this problem in a four-line table where you will install.

My rule for a small shop with four products

Your selected trial database Home Open the tab. The following two commands are glued to the same box and Home Press button. This button on your interface Home It may also appear by the name. Dotted comma informs where each command is over. Run this first box once in the empty database. You can try the next boxes in order and separately.
CREATE TABLE ornek_vitrin (
  id INT PRIMARY KEY,
  ad VARCHAR(60) NOT NULL,
  fiyat DECIMAL(8,2) NOT NULL,
  stok INT NOT NULL
);

INSERT INTO ornek_vitrin (id, ad, fiyat, stok)
VALUES
  (1, 'Defter', 80.00, 6),
  (2, 'Kalem', 25.00, 12),
  (3, 'Cetvel', 30.00, 0),
  (4, 'Silgi', 15.00, 3);
The CREATE TABLE prepared the columns of the book. INSERT INTO added four products to these pillars. 25.00 price in the line of the pen, 12 stock. A tenacity price in SQL 25.50 format, type with point. Virgül separates the fields here from each other. From the list on the left ornek vitrin table, then Home Click on the tab. If you can see four products, the rest of the exercise is ready. Home On the tab you can see that the id area is primary key. Even if two products carry the same name, this number determines which line you work.

Which is the cheapest two products in stock?

Before you run the command, look at products and guess the answer. The kalem pen is slightly expensive but it hasn’t been left on the shelf anyway. It is necessary to decide two separates of the vine. First they will find the remaining ones, then they will sort them according to price.
SELECT ad, fiyat, stok
FROM ornek_vitrin
WHERE stok > 0
ORDER BY fiyat ASC, id ASC
LIMIT 2;
All Home first place (15.00, in stock 3), Tags In the second place (25.00, 12 in stock) appears. The columns you want to see SELECT choose the table to read from. WHERE determines which lines will remain. ORDER BY ranks the remaining ones. ASC means small to grow. Two prices equally determine the id row with the second ranking area. LIMIT 2 brings the first two results.

Now only the price ASC part of the price DESC is structured and run again. This time, the Notebook comes first. When you open the table and browse, four products are in the native place. The question you have changed at that moment asked.

How many kinds of products have, how many parts remained on the shelf?

One in the shop may come to two answers to your mind when you say “The product remained”. Three types of products can be sold. But if you count one single, there are six notebooks, twelve pens and three erasers. You can also ask them individually in SQL.
SELECT COUNT(*) AS urun_cesidi,
       SUM(stok) AS toplam_adet
FROM ornek_vitrin
WHERE stok > 0;
COUNT(*) counts lines that meet the condition, SUM(stok) collects pieces in those lines. The result is in one line 3 and 21. September. The names you provide with AS are already reading the result chart. Now you find some kind of products and zero pieces if you make the condition in the last line WHERE stock = 0. The difference between the fact that the listede is ready for sale without stopping in the list tells the same table.

What line changes when a box comes in pencil?

Six pens came more. Read the line you will change first. The following first query should show you Pen and 12 value. You will also see the same condition in the second command.
SELECT id, ad, stok FROM ornek_vitrin WHERE id = 2;
UPDATE ornek_vitrin
SET stok = stok + 6
WHERE id = 2;
UPDATE changes current registration. SET stock = stock + 6 old attachments. Run this update once, then try again the first SELECT query. The pen stoğu no longer 18 September. You add six more if you press the same UPDATE command. If you remove the NE line, it is added six to each product on the table. That's why it's a good habit to see with a small reading query that the condition has been found correctly.

Back to the first question to try on your own. Is the name of the cheapest two products in stock changed? Well, how many parts were there? The first result is still Pen with Silgi, if the new total is 27. It’s a nice way to learn to read the queries that only change one answer from two questions of the same update.

Update stock without writing SQL with Database Manager

You may not want to write queries for each job. For example, a friend in the warehouse “I found a pen more, you’re going to do 19?” said. Some site panels are for this Database Manager This tool offers daily works on a simpler screen, such as registration search, cell editing and backup. It is easy to see the difference between the previous stock sample.

Here in the sample panel Settings → Database admin opens from the road. Select ornek vitrin table when it is connected to your trial database. Select name as column in search field and select Tags type and Search Press the button. In the incoming line you will see the stock 18. The choice you do with WHERE in the SQL section corresponds to a column and a search box here.

Open the stock cell and type 19. Apply When you say, the editing is added to the pending changes. You can view once again before registering. Is the right line Pen, do you change column stock? Then Save Changes Press the button. Now you'll see 19 if you read the same record at phpMyAdmin. You also need to transfer data as two tools read the value on the same table.

The next day “There are several types of products on the floor, the total few parts remained?” If the question comes from above you can return to COUNT and SUM query. It is practical to open a cell on the panel while interested in single product. If you want to evaluate multiple records together, you know if you want to use your SQL business.

Take your trial table

Select the sample table at phpMyAdmin Export You can download from the SQL format. In an out transfer that contains structure and data, you will see familiar commands when you open the file with text editor. One tells how to install the table, others how to add products back. The file is in a second empty trial database Export After opening with Pen, look for the last moment you have saved.

If your panel gives you the backup as JSON, choose the tool that supports that format to restore. In some managers, structure and records are individually marked, also the number of lines to be taken per table is limited. Our four products provide a small control. Do you find four lines and current pen aded in the table you have restored? What's actually in the heart when you see two You know that.
Zero Risk without license cost Free Trial
Zonely Your website and store single panel
Your Community Game Discord from together
Zonely For Your Website Powerful Infrastructure
Your Domain Name Your brand Zonely Power

“I give it 10 out of 10. Even other software doesn’t offer this many features.”

— . [maxland.com.tr]

“The support part is very fast and they are interested in everything necessary.”

— Rentr [cyraxnw.com]

“A software company that puts real care into its work and listens to feedback.”

— Forrise [minghost.net.tr]

Your community, all in one place.

Store, games and conversations.

Customize your website, track sales and reach your players. Bring the tools you use to manage your community together in one dashboard.

Get your store ready to launch.

Create products and categories. Set prices, stock and delivery options, then manage sales on your own website.

Explore

From sale to delivery.

Connect products to server commands. Use supported game integrations to deliver ranks, items and packages automatically after an order.

Explore

Make the design your own.

Choose a ready-made theme and adjust colors, fonts, menus and pages to your brand. Preview your changes before publishing.

Explore

Keep support in one place.

Answer members’ questions, follow conversations and share support requests with your team. Keep help articles in one accessible place.

Explore

Stay connected with Discord.

Link website memberships with Discord accounts. Manage your website and community together with role connections and notifications.

Explore

Keep track of your store.

Review orders, payments and user activity. Compare products and sales periods to see how your store is doing.

Explore

Work together as a team.

Set role permissions for support, content and administration. Give each team member the access they need and follow changes through activity records.

Explore

Keep your files within reach.

Edit theme files in the template editor. Access your data, make backups and develop your site with file and database tools.

Explore

Let’s Build Zonely Together

Become part of the community

Ask questions, share your experience and send us your ideas. Stay connected with the Zonely community as you build your project.

Follow the news, release innovations and tips for use.

Join the community; share your questions and experiences.

Tell errors, contribute to your recommendations and improvements.

Zonely

November 22, 2026

Hello ,, what can I help you?