SQL语句进行增删改查
时间: 2023-06-29 10:07:55 浏览: 94
SQL语句是结构化查询语言的简称,是用于管理关系数据库系统中数据的语言。以下是SQL语句进行增删改查的示例:
1. 增加数据:
```
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
```
例如:
```
INSERT INTO customers (name, email, phone)
VALUES ('John Doe', 'johndoe@email.com', '123456789');
```
2. 删除数据:
```
DELETE FROM table_name
WHERE some_column = some_value;
```
例如:
```
DELETE FROM customers
WHERE id = 1;
```
3. 修改数据:
```
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE some_column = some_value;
```
例如:
```
UPDATE customers
SET name = 'Jane Doe', email = 'janedoe@email.com'
WHERE id = 2;
```
4. 查询数据:
```
SELECT column1, column2, ...
FROM table_name
WHERE some_column = some_value;
```
例如:
```
SELECT name, email, phone
FROM customers
WHERE id = 2;
```
阅读全文