以下是数据库中常用的基本语句示例,包括增加(INSERT)、删除(DELETE)、修改(UPDATE)和查询(SELECT):
- 增加数据(INSERT):
INSERT INTO table_name (column1, column2, ...)
VALUES (value1, value2, ...);
示例:
INSERT INTO employees (first_name, last_name, salary)
VALUES ('John', 'Doe', 5000);
- 删除数据(DELETE):
DELETE FROM table_name
WHERE condition;
示例:
DELETE FROM employees
WHERE id = 1;
- 修改数据(UPDATE):
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
示例:
UPDATE employees
SET salary = 6000
WHERE id = 1;
- 查询数据(SELECT):
SELECT column1, column2, ...
FROM table_name
WHERE condition;
示例:
SELECT first_name, last_name, salary
FROM employees
WHERE department = 'IT';
请注意,上述示例中的表名、列名和条件都需要根据实际情况进行替换和调整。此外,SQL语句还有其他更复杂和高级的用法,这里仅提供了基本的语法示例。