oracle数据库常见sql
时间: 2024-03-17 18:38:27 浏览: 68
Oracle数据库是一种关系型数据库管理系统,它支持SQL语言进行数据操作和管理。下面是一些常见的Oracle SQL语句:
1. 创建表:
CREATE TABLE table_name (
column1 datatype constraint,
column2 datatype constraint,
...
);
2. 插入数据:
INSERT INTO table_name (column1, column2, ...)
VALUES (value1, value2, ...);
3. 更新数据:
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
4. 删除数据:
DELETE FROM table_name
WHERE condition;
5. 查询数据:
SELECT column1, column2, ...
FROM table_name
WHERE condition;
6. 排序数据:
SELECT column1, column2, ...
FROM table_name
ORDER BY column1 ASC/DESC;
7. 聚合函数:
SELECT COUNT(column), SUM(column), AVG(column), MAX(column), MIN(column)
FROM table_name
WHERE condition;
8. 连接表:
SELECT column1, column2, ...
FROM table1
INNER/LEFT/RIGHT JOIN table2
ON table1.column = table2.column;
9. 子查询:
SELECT column1, column2, ...
FROM table_name
WHERE column IN (SELECT column FROM another_table WHERE condition);
10. 创建索引:
CREATE INDEX index_name
ON table_name (column1, column2, ...);
以上是一些常见的Oracle SQL语句,希望对你有帮助。
阅读全文