sql server增删改查
时间: 2023-09-11 19:10:36 浏览: 106
SQL server 增删改查
SQL Server 是一种关系型数据库管理系统 (RDBMS),以下是 SQL Server 的增删改查语句示例:
1. 插入数据
```sql
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
```
例如:
```sql
INSERT INTO customers (customer_name, city, country)
VALUES ('John Smith', 'New York', 'USA');
```
2. 更新数据
```sql
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
```
例如:
```sql
UPDATE customers
SET city = 'Los Angeles'
WHERE customer_id = 1;
```
3. 删除数据
```sql
DELETE FROM table_name WHERE condition;
```
例如:
```sql
DELETE FROM customers WHERE customer_id = 1;
```
4. 查询数据
```sql
SELECT column1, column2, ...
FROM table_name
WHERE condition;
```
例如:
```sql
SELECT customer_name, city, country
FROM customers
WHERE customer_id = 1;
```
以上是 SQL Server 的基本增删改查语句,还可以使用 JOIN、GROUP BY、ORDER BY 等语句对数据进行更复杂的操作。
阅读全文