Add, delete, modify and query 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 is used to modify the data in the table; 4. "SELECT" statement is used to select data from the table.
The add, delete, modify and query statements in sql are used to operate on data in the database, so in this article we will take a look at the SQL add, delete, modify and query statements. specific writing method.
1. Addition of SQL statements
INSERT INTO 表名 VALUES (值1,....)
Insert a student’s data into the student table
insert into student (num,name,sex,age) values(140010,张三,男,23)
2. SQL Statement deletion
DELETE FROM 表名称 WHERE 列名称 = 值
Delete the data with num=140011 in the student table.
delete from student where num=140011;
3. Change of SQL statement
UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
We can change the age value of num 140010 to 21.
update student set age =21 where ID=140010;
4. Query of SQL statements
SELECT 列名称 FROM 表名称 //以及: SELECT * FROM 表名称
The query statement is very important, so it needs to be explained in detail.
1. Query all the data in the student table
select * from student;
2. Query all the names and sex in the student table
select name,sex from student;
3. Query the row where num is 140010 Data
select * from where id =140010;
The above is the detailed content of What is the sql add, delete, modify, query statement?. For more information, please follow other related articles on the PHP Chinese website!