plsql高级查询命令

一.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';

 

转载于:https://www.cnblogs.com/hackxiyu/p/6732837.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值