SoFunction
Updated on 2024-11-15

Basic tutorial on add, delete, change sql syntax

Add, delete, and change statements in sql:

1, "INSERT INTO" statement, used to add new rows to the table;

2, "DELETE" statement, used to delete rows in the table;

3. "Update" statement, used to modify the data in the table;

4, "SELECT" statement, used to select data from the table

I. Increase in grammar

INSERT INTO table name VALUES ((be) worth1,....)

for example: Insert a student's data into the student table

INSERT INTO STUDENT (num,name,sex,age)
VALUES(123456789,'zhangsan','Male',23)

II. Delete statement

DELETE FROM Table name WHERE column name = (be) worth

for example: Delete this entry in the student table with num=123456789.

DELETE FROM student WHERE num=123456789;

III. Modifying/updating statements

UPDATE Table name SET column name = new value WHERE column name = some value

for example: We can change the age value of num to 123456789 to 21.

UPDATE student SET age =21 WHERE ID=123456789;

IV. Query statements

SELECT column name FROM Table name

As well:

SELECT * FROM Table name

Query statements are very important in real projects, so they need to be said in detail.

1, query student table all data

SELECT * FROM student;

2, query student table all the name and sex

SELECT name,sex FROM student;

3, query num for 123456789 this line of data

SELECT * FROM WHERE id =123456789;

summarize

To this article on the basics of addition, deletion and change of sql syntax tutorial article is introduced to this, more related to the addition, deletion and change of sql syntax content, please search for my previous articles or continue to browse the following related articles I hope that you will support me more in the future!