mysql 简单的增删改查语句_MySQL
增加记录:
注: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)

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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? 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

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? 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

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

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 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.

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.
