首页 > 代码库 > plaql高级查询命令
plaql高级查询命令
一.DDL数据定义语言:表操作
1.新建表
SQL> create table good(id number,name varchar2(10));
添加注释
SQL> comment on table good is ‘商品数据‘;
SQL> comment on table good.id is ‘商品id‘;
2.删除表
SQL> drop table students;
3.改动表
a.改表结构
SQL> alter table student drop column gender;
b.改表名字
SQL> alter table student rename to students;
c.添加约束
SQL> alter table good add primary key(id);
SQL> alter table student modify age not null;
4.查看表
SQL> select table_name from user_tables;
SQL> desc student;
二.DML数据操纵语言:表数据操作
1.增数据
SQL> insert into good values(1,‘aaa‘,2.0);
如果是从其他表添加,追加select
2.删数据
SQL> delete from good where id=1;
3.改数据
SQL> update good set price=5.0 where id=2;
4.查数据
SQL> select * from good;
a.排序查找
SQL> select * from good order by price;
b.输出显示优化
SQL> select ‘0‘||id as "编号",name as "名字",price as "价格" from good ;
c.指定查找
SQL> select * from good where price in(2);
d.范围查找
SQL> select * from good where price between 1 and 3;
e.模糊查找
SQL> select * from good where name like ‘%b‘;
plaql高级查询命令
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。