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

Operation cases of data in MySQL

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you the operation of data in MySQL cases, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to understand it!

First, add data

Ordinary insertion

INSERT INTO info1 VALUES (1 'Einstein', 'Theory of Relativity')

In one case, only part of the data is inserted, as follows:

INSERT INTO info1 (id,name) VALUES (2pm 'Edison')

Insert multiple pieces of data at a time

INSERT INTO info1 VALUES (3) Turing, AI), (4) Leonardo da Vinci, Aesthetics), (5) Nietzsche, Aesthetics)

Query data

SELECT * FROM info1 WHERE id=2

The queried data can be added to the list as data.

2. Delete data

Delete part of the data

DELETE FROM info1 WHERE name=' Maria Ozawa'

Delete all data 1 in the table, the structure of the table remains the same, but do not delete the self-increasing primary key of the table

DELETE FROM info1

Delete all the data in the table 2, the structure of the table remains unchanged. Delete the self-incrementing primary key of the table. Unlike delete, it has to look at it one by one and then delete it, but it is emptied directly, which can be associated with the formatting of the disk. As follows:

TRUNCATE info1

3. Modify data

Selective modification 1

UPDATE info1 SET contribution=' philosophy, Aesthetics' WHERE id=5

Separate multiple columns with commas

UPDATE info1 SET named=' da Vinci, contribution=' artist, inventor and physician 'WHERE id=4

Fourth, query data

1. Simple query

(1) query all

(2) query specified items

SELECT named,country FROM info1 above is all the contents of this article entitled "data manipulation cases in MySQL". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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

Database

Wechat

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

12
Report