Home Database Mysql Tutorial mysql 简单的增删改查语句_MySQL

mysql 简单的增删改查语句_MySQL

May 30, 2016 pm 05:11 PM
statement

增加记录:

 

注:null关键字与auto_increment限制条件相结合,可以为字段自动赋值;字段必须全,且一一对应;字符型用单引号;

 

1 mysql> insert into test values('sunshine_habit','hello_world_lyq@163.com'

2     -> ,1558888888,null);

输出:

3 Query OK, 1 row affected (0.10 sec)

查询记录:

 

 

1 mysql> select * from test where name='sunshine_habit';

2 输出:

3 +----------------+-------------------------+--------------+----+

4 | name           | email                   | phone_number | id |

5 +----------------+-------------------------+--------------+----+

6 | sunshine_habit | hello_world_lyq@163.com |   1558888888 |  1 |

7 +----------------+-------------------------+--------------+----+

8 1 row in set (0.00 sec)

 

 修改记录:

 

1 mysql> update test set name='Sam' where name='sunshine';

输出:

2 Query OK, 1 row affected (0.06 sec)

3 Rows matched: 1  Changed: 1  Warnings: 0

删除记录

 

1 mysql> delete from test where name='Snow White';

2 Query OK, 1 row affected (0.08 sec)

Statement of this Website
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

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)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

multi-catch statement in PHP8.0 multi-catch statement in PHP8.0 May 14, 2023 pm 01:51 PM

With the development of web applications, PHP language has been widely used in web development. In the PHP8.0 version, a new language feature was introduced - the multi-catch statement. What is a multi-catch statement? In previous PHP versions, developers needed to write multiple catch statements to handle multiple exception types. For example, the following code block shows the handling of two different exceptions: try{//Somecodethatmay

How to implement the statement of inserting data in MySQL? How to implement the statement of inserting data in MySQL? Nov 08, 2023 am 11:48 AM

How to implement the statement of inserting data in MySQL? When using a MySQL database, inserting data is a very basic and common operation. By inserting data, new records can be added to database tables to provide support for business operations. This article will introduce how to use the INSERT statement in MySQL to implement data insertion operations, and provide specific code examples. The INSERT statement in MySQL is used to insert new records into the database table. Its basic syntax format is as follows: INSERTINTOt

To understand flow control statements in Python, you need to master several situations To understand flow control statements in Python, you need to master several situations Jan 20, 2024 am 08:06 AM

Python is a widely used high-level programming language. It is easy to learn, efficient and flexible, and is deeply loved by developers. In Python, flow control statements are an important part of implementing program logic. This article will introduce commonly used flow control statements in Python and provide code examples to deepen understanding. In Python, common flow control statements include conditional statements and loop statements. Conditional statements execute different code blocks based on the true or false condition and are used to determine and select execution branches. The loop statement is used to repeat

How to implement the statement to unlock the table in MySQL? How to implement the statement to unlock the table in MySQL? Nov 08, 2023 pm 06:28 PM

How to implement the statement to unlock the table in MySQL? In MySQL, table locks are a commonly used locking mechanism used to protect data integrity and consistency. When a transaction is reading and writing to a table, other transactions cannot modify the table. This locking mechanism ensures data consistency to a certain extent, but may also cause other transactions to be blocked. Therefore, if a transaction cannot continue for some reason, we need to manually unlock the table so that other transactions can continue. MySQL provides a variety of

Master the types of Python flow control statements and learn from scratch! Master the types of Python flow control statements and learn from scratch! Jan 20, 2024 am 09:02 AM

To learn Python from scratch, first understand the types of flow control statements! Python is a simple and powerful programming language that is widely used in data analysis, artificial intelligence, network development and various scientific computing fields. As a beginner, it is very important to master basic flow control statements, because they are the basis for realizing logical judgment and controlling the program execution flow. In Python, there are three main types of flow control statements: sequential structures, conditional structures and loop structures. The following will introduce these three process control statements in detail and give the corresponding

C# try statement usage C# try statement usage Feb 22, 2024 pm 12:45 PM

The usage of try statement in C# requires specific code examples. C# is an object-oriented programming language, in which the try statement is a structure used to capture and handle exceptions. Through the try statement, we can write code to handle exceptions that may occur, thereby improving the stability and reliability of the program. In this article, we will introduce the usage of try statement in C# and provide some specific code examples to help readers understand. In C#, the try statement consists of try block, catch block and optionalfina

The purpose of SQL ALTER statement The purpose of SQL ALTER statement Feb 19, 2024 pm 05:01 PM

The function of the SQL ALTER statement requires specific code examples. In a database management system, the ALTER statement is a SQL command used to modify database objects. Through the ALTER statement, we can modify database objects such as tables, columns, indexes, and views, including adding, deleting, modifying, and other operations. The following will introduce the common usage of the ALTER statement in detail and provide relevant code examples. ALTERTABLE statement is used to modify the structure of the table. You can add, delete, modify columns, constraints, indexes, etc.

How to implement the statement to change user password in MySQL? How to implement the statement to change user password in MySQL? Nov 08, 2023 am 09:05 AM

MySQL is a commonly used relational database system used to manage and store data. In MySQL, user passwords are one of the important factors in protecting database security. In daily management of the database, it is often necessary to change the user's password to ensure the security of the database. So, how to implement the statement of changing user password in MySQL? This article will provide you with specific code examples. Change the MySQL user password through the ALTERUSER statement. The ALTERUSER statement is MySQL8.0 and above.

See all articles