What is the sql add, delete, modify, query statement?

不言
Release: 2022-01-12 15:19:11
Original
201585 people have browsed it

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.

What is the sql add, delete, modify, query statement?

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,....)
Copy after login

Insert a student’s data into the student table

insert into student (num,name,sex,age) values(140010,张三,男,23)
Copy after login

2. SQL Statement deletion

DELETE FROM 表名称 WHERE 列名称 = 值
Copy after login

Delete the data with num=140011 in the student table.

delete from student where num=140011;
Copy after login

3. Change of SQL statement

UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
Copy after login

We can change the age value of num 140010 to 21.

update student set age =21 where ID=140010;
Copy after login

4. Query of SQL statements

SELECT 列名称 FROM 表名称 //以及: SELECT * FROM 表名称
Copy after login

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;
Copy after login

2. Query all the names and sex in the student table

select name,sex from student;
Copy after login

3. Query the row where num is 140010 Data

select * from where id =140010;
Copy after login

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!

Related labels:
sql
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!