1、创建表:CREATE TABLE table_name (column1 datatype, column2 datatype, …);
创新互联建站长期为上千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为新区企业提供专业的成都做网站、成都网站制作,新区网站改版等技术服务。拥有10余年丰富建站经验和众多成功案例,为您定制开发。
2、添加列:ALTER TABLE table_name ADD column_name datatype;
3、删除列:ALTER TABLE table_name DROP COLUMN column_name;
4、修改列:ALTER TABLE table_name MODIFY column_name datatype;
5、重命名表:RENAME table_name TO new_table_name;
6、删除表:DROP TABLE table_name;
7、插入单行数据:INSERT INTO table_name (column1, column2, …) VALUES (value1, value2, …);
8、插入多行数据:INSERT ALL INTO table_name (column1, column2, …) VALUES (value1, value2, …) INTO temp SELECT column1, column2, … FROM another_table;
9、从其他表中复制数据:INSERT INTO table_name (column1, column2, …) SELECT column1, column2, … FROM another_table;
10、查询所有数据:SELECT * FROM table_name;
11、查询指定列:SELECT column1, column2, … FROM table_name;
12、查询满足条件的数据:SELECT * FROM table_name WHERE condition;
13、排序查询结果:SELECT * FROM table_name ORDER BY column1 ASC/DESC;
14、分组查询:SELECT column1, column2, … FROM table_name GROUP BY column1;
15、连接查询:SELECT * FROM table1 INNER/LEFT/RIGHT/FULL JOIN table2 ON table1.column = table2.column;
16、更新单行数据:UPDATE table_name SET column1 = value1, column2 = value2, … WHERE condition;
17、更新多行数据:UPDATE table_name SET column1 = value1, column2 = value2, … WHERE condition;
18、使用子查询更新数据:UPDATE table_name SET column1 = (SELECT column1 FROM another_table WHERE condition), column2 = (SELECT column2 FROM another_table WHERE condition) WHERE condition;
19、删除单行数据:DELETE FROM table_name WHERE condition;
20、删除多行数据:DELETE FROM table_name WHERE condition;
21、删除表中所有数据:DELETE FROM table_name;
22、创建索引:CREATE [UNIQUE] INDEX index_name ON table_name (column1, column2, …);
23、删除索引:DROP INDEX index_name;
24、主键约束:ALTER TABLE table_name ADD PRIMARY KEY (column1);
25、外键约束:ALTER TABLE table_name ADD FOREIGN KEY (column1) REFERENCES another_table(column2);
26、NOT NULL约束:ALTER TABLE table_name ALTER COLUMN column1 NOT NULL;
27、CHECK约束:ALTER TABLE table_name ADD CONSTRAINT check_constraint check_condition;
28、BEGIN:开始事务处理;
29、SAVEPOINT savepoint_name:设置保存点;
30、ROLBACK TO savepoint_name:回滚到保存点;
31、COMMIT:提交事务;
32、ROLLBACK:回滚事务。
33、创建存储过程:CREATE PROCEDURE procedure_name (parameter1 datatype, parameter2 datatype, …) IS/AS BEGIN … END;
34、调用存储过程:CALL procedure_name (value1, value2, …);
35、创建函数:CREATE [OR REPLACE] function_name (parameter1 datatype, parameter2 datatype, …) RETURN datatype IS/AS BEGIN … RETURN result; END;
36、调用函数:result := function_name (value1, value2, …);
37、创建触发器:CREATE [OR REPLACE] [TRIGGER] trigger_name {BEFORE |AFTER} {INSERT |UPDATE |DELETE} ON table_name FOR EACH row [WHEN condition] BEGIN … END;
38、删除触发器:DROP [TRIGGER] trigger_name;
39、禁用触发器:DISABLE [TRIGGER] trigger_name;
40、启用触发器:ENABLE [TRIGGER] trigger_name;
41、创建视图:CREATE [OR REPLACE] [VIEW] view_name AS select_statement;
42、删除视图:DROP [VIEW] view_name;
43、创建物化视图:CREATE MATERIALIZED [VIEW] view_name [WITH NOCACHE] AS select_statement;
44、删除物化视图:DROP MATERIALIZED [VIEW] view_name;
45、刷新物化视图:REFRESH MATERIALIZED [VIEW] view_name [COMPLETE|FORCE];
文章题目:Oracle50条语句突破技术边界
文章网址:http://www.shufengxianlan.com/qtweb/news9/300409.html
网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联