Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the basic operation of data data in MySQL database

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what is the basic operation of data data in MySQL database". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the basic operation of data data in MySQL database".

Insert operation-method 1: insert specified field data (recommended) insert into table name [(field list)] values (corresponding column data);-method 2: insert data corresponding to all fields insert into table name values (corresponding column data)

Example:

Create table tb_teacher (name varchar (10), age int);-- insert a data insert into tb_teacher (name, age) values ('Jack', 24);-- Field names and values need to correspond to insert into tb_teacher (age, name) values (25,' Tom');-- you can insert only part of the field data insert into tb_teacher (name) values ('Steve') -- insert data corresponding to all fields. In this case, the value list needs to correspond to the table structure insert into tb_teacher values ('Jery', 23); query operation-- query all field data in the table select * from table name;-- query some field data in the table data select field list from table name;-- simple conditional query data select field list / * from table name where field name = value

Example:

-- query all data select * from tb_teacher;+-+-+ | name | age | +-+-+ | Jack | 24 | Tom | 25 | Steve | NULL | | Jery | 23 | +-- specified field select name from tb_teacher +-+ | name | +-+ | Jack | | Tom | | Steve | | Jery | +-+-- restriction condition, age = = 23select name from tb_teacher where age = 23 delete from + | name | +-+ | Jery | +-+ delete operation-if there is no condition, all data will be deleted [where condition] -- delete the data with the age of 23 delete from tb_teacher where age = 23 position select * from tb_teacher +-+-+ | name | age | +-+-+ | Jack | 24 | Tom | 25 | Steve | NULL | +-+-+ update operation-if there is no where condition, all values in the table will be updated update table name set field name = new value [where condition]

Example:

-- the age of updating Tom is 26update tb_teacher set age = 26 where name = 'Tom';select * from tb_teacher +-+-+ | name | age | +-+-+ | Jack | 24 | Tom | 26 | Steve | NULL | +-+-+ Thank you for reading. This is the content of "what is the basic operation of data data in MySQL database". After the study of this article I believe that you have a deeper understanding of what is the basic operation of data data in MySQL database, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report