oracle中常用的sql语句--基本语句

--创建新表

create table tableName(

tid number primary key,

tname varchar(20) not null

)

--创建序列

create sequence seq_tableName

start with 1

increment by 1;


--添加数据

insert into tableName(tid,tname) values(seq_tableName.nextval,'张三');

--更新数据

update tableName set tname  = "mary" where tname = "张三";

--删除数据

1.删除一条数据

delete tableName where tname ="张三"

2.删除多条数据(用点连接查询,以后会介绍关于连接查询方面的)

delete tableName where tname(

select tname from tableName

)


--删除表

drop table tableName;

--修改表名

alter table tableName rename to tableName1

--表数据的复制

insert into tableName as (select * from table1)

--复制表结构

create table tableName3 as select * from tableName where 1=2;

--复制指定的字段

create table tableName3 as select tname,sex from tableName where 1=2;

--条件查询

select id ,name  (case sex when 0 then '男' when 1 then '女' end if) as sex from tableName3  

--查询某个人的信息

select id,name,( case sex when 0 then '男' whem 1 then '女' end if) as sex from tableName3 where name ='Mary'





  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值