search
HomeDatabaseMysql TutorialTutorial on adding, deleting, modifying and querying data tables using SQL statements (phpMyAdmin usage tutorial)

In phpMyAdmin, when we click sql, we can write complete sql statements to perform table operations, such as querying, adding, modifying, and deleting data tables, which is what we often call add, delete, modify, and query. .

1. SQL statement to add data table

Use sql statement to insert data, Here we need to use insert into

Tutorial on adding, deleting, modifying and querying data tables using SQL statements (phpMyAdmin usage tutorial)

There is no data in the admin table. Let’s write a sql statement to add a piece of data to the table

INSERT INTO `admin`(`id`, `name`, `pwd`) VALUES (1,'admin','123456')

Then execute, if an error is reported, then we have not added it .

Tutorial on adding, deleting, modifying and querying data tables using SQL statements (phpMyAdmin usage tutorial)

In this way we have completed adding a piece of data. Now let’s go to the table to see if the data we just added exists

Tutorial on adding, deleting, modifying and querying data tables using SQL statements (phpMyAdmin usage tutorial)

You can see that the data we just added exists in the table

2. SQL statement to modify the data table

Use sql statement to modify the data. We need to use the update statement. It should be noted that we are now using SQL statements to make modifications, so conditional modifications are required. For example, there are 5 pieces of information in my database table. If there are no conditions for modification, which piece should be modified? So we need to take this into consideration.

We just added a piece of information, and then I added several pieces of information to the data table

Tutorial on adding, deleting, modifying and querying data tables using SQL statements (phpMyAdmin usage tutorial)

We now need to modify the third piece of information, So how to write sql statement?

UPDATE `admin` SET `name`='admin',`pwd`= '55555' WHERE id=3

Tutorial on adding, deleting, modifying and querying data tables using SQL statements (phpMyAdmin usage tutorial)

In this way we will change the information of the data with id equal to 3

3. Query the information in the data table

Now we have to query the data table All the information in the table, then when we write the sql statement, we can write

select * from admin

. In this way, we can query the information in the table. Of course We can also query with conditions. There are 4 pieces of data in our admin table. I only want to query the data whose id is 1. At this time we have to write conditions

select * from admin where id =1

Tutorial on adding, deleting, modifying and querying data tables using SQL statements (phpMyAdmin usage tutorial)

If I want to query the data whose id is less than 3, then we can write like this

select * from admin where id

Tutorial on adding, deleting, modifying and querying data tables using SQL statements (phpMyAdmin usage tutorial)

In this way, all ids less than 3 are queried.

4. SQL statement to delete the data table

To delete the information in the data table, we need to use delete. We want to delete the id of 4 in the data table. Data

delete from `admin` where id=4

Tutorial on adding, deleting, modifying and querying data tables using SQL statements (phpMyAdmin usage tutorial)

After performing the deletion operation, we You can check the data in the table

Tutorial on adding, deleting, modifying and querying data tables using SQL statements (phpMyAdmin usage tutorial)

In this way, the data with id 4 in the table has been deleted.

The above is the detailed content of Tutorial on adding, deleting, modifying and querying data tables using SQL statements (phpMyAdmin usage tutorial). For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
SQL Server使用CROSS APPLY与OUTER APPLY实现连接查询SQL Server使用CROSS APPLY与OUTER APPLY实现连接查询Aug 26, 2022 pm 02:07 PM

本篇文章给大家带来了关于SQL的相关知识,其中主要介绍了SQL Server使用CROSS APPLY与OUTER APPLY实现连接查询的方法,文中通过示例代码介绍的非常详细,下面一起来看一下,希望对大家有帮助。

SQL Server解析/操作Json格式字段数据的方法实例SQL Server解析/操作Json格式字段数据的方法实例Aug 29, 2022 pm 12:00 PM

本篇文章给大家带来了关于SQL server的相关知识,其中主要介绍了SQL SERVER没有自带的解析json函数,需要自建一个函数(表值函数),下面介绍关于SQL Server解析/操作Json格式字段数据的相关资料,希望对大家有帮助。

聊聊优化sql中order By语句的方法聊聊优化sql中order By语句的方法Sep 27, 2022 pm 01:45 PM

如何优化sql中的orderBy语句?下面本篇文章给大家介绍一下优化sql中orderBy语句的方法,具有很好的参考价值,希望对大家有所帮助。

Go语言如何实现数据库的增删改查操作?Go语言如何实现数据库的增删改查操作?Mar 27, 2024 pm 09:39 PM

Go语言是一种高效、简洁且易于学习的编程语言,因其在并发编程和网络编程方面的优势而备受开发者青睐。在实际开发中,数据库操作是不可或缺的一部分,本文将介绍如何使用Go语言实现数据库的增删改查操作。在Go语言中,我们通常使用第三方库来操作数据库,比如常用的sql包、gorm等。这里以sql包为例介绍如何实现数据库的增删改查操作。假设我们使用的是MySQL数据库。

一文搞懂SQL中的开窗函数一文搞懂SQL中的开窗函数Sep 02, 2022 pm 04:55 PM

本篇文章给大家带来了关于SQL server的相关知识,开窗函数也叫分析函数有两类,一类是聚合开窗函数,一类是排序开窗函数,下面这篇文章主要给大家介绍了关于SQL中开窗函数的相关资料,文中通过实例代码介绍的非常详细,需要的朋友可以参考下。

linux运行sql文件命令是什么linux运行sql文件命令是什么Mar 02, 2023 am 10:30 AM

linux运行sql文件命令是“psql -f test.sql”,其Linux运行sql脚本的方法是:1、使用shell工具登录到安装postgresql的服务器;2、编辑sql脚本内容;3、通过“psql -f test.sql”命令执行“test.sql”脚本即可。

SqlServer创建自动收缩事务日志任务的图文详解SqlServer创建自动收缩事务日志任务的图文详解Sep 09, 2022 pm 01:41 PM

本篇文章给大家带来了关于SQL server的相关知识,SQL Server数据库存在一个问题,如果你限制了它的日志文件的大小,那么当数据库日志达到这个大小的时候,数据库就会停止写入日志,下面这介绍了关于SqlServer创建自动收缩事务日志任务的相关资料,希望对大家有帮助。

SQL Server跨服务器操作数据库的图文方法(LinkedServer)SQL Server跨服务器操作数据库的图文方法(LinkedServer)Nov 02, 2022 pm 04:13 PM

本篇文章给大家带来了关于SQL的相关知识,其中主要介绍了SQL Server跨服务器操作数据库的图文方法,SQL Server Management Studio (SSMS) 是用于管理SQL Server 基础结构的集成环境,下面一起来看一下,希望对大家有帮助。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.