Get the App
SLTechnology News&Howtos  ›  Database  › 

Operation cases of data in MySQL

Shulou Source: shulou.com Published: 2022-06-01 01:48:27 10月03日 Update

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!

Tags: Data queries articles aesthetics cases content structure parts ordinary not so artificial intelligence medicine medical scientists inventors philosophy Turing multiple most situation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Linux MySQL Shulou Technology Xiaomi