Article From:https://www.cnblogs.com/hello-dummy/p/9216888.html

DML(data manipulation language);Data manipulation language

Insert data:
Insert data: only one row of data can be inserted at a time
INSERT INTO Table name (column name 1, column name 2, column name 3…) VALUES (value1, Value2, value3…); value corresponds to column number one by one.
#Insert a line:
INSERT INTO t_student(id,name,email,age) VALUES (null,’King two ‘,’qwqw@’, 23)

#Insert a partial value:
INSERYT INTO t_student(name, age) VALUES (‘Zhao Si ‘, 40)

#Insert multiple data: MySQL only
INSERT INTO t_student(name) SELECT name FROM t_student


 

UPDATE statement:
UPDATAE Table name SET column name 1 = value1, column name 2 = Value2…, WHEREid = 4
Note: if there is no where condition, all will be modified.
#Modify one
UPDATE t_student set email=’zhangsan@’ WHERE id = 1

#Modify multiple

UPDATE t_student set email=’xiaoming@’, name=’Xiao Ming ‘WHERE id = 1

#Notice that the primary key can not be modified, not not. If you modify the primary key, you can’t find it next time.


 

Delete statements:
DELETE FROM t_student WHERE [Conditions], delete qualified data
If there is no WHERE, the data is emptied

Leave a Reply

Your email address will not be published. Required fields are marked *