找回密码
 立即注册
查看: 139|回复: 0

Oracle数据库常用语法

22

主题

5

回帖

304

积分

管理员

积分
304
发表于 2024-3-11 00:32:52 | 显示全部楼层 |阅读模式
--新建表:
create table table1( id varchar(300) primary key, name varchar(200) not null);

--插入数据
insert into table1 (id,name) values ('aa','bb');

--更新数据
update table1 set id = 'bb' where id='cc';

--删除数据
delete from table1 where id ='cc';

--删除表
drop table table1;

--修改表名:
alter table table1 rename to table2;

--表数据复制:
insert into table1 (select * from table2);

--复制表结构:
create table table1 select * from table2 where 1>1;

复制表结构和数据:
create table table1 select * from table2;

复制指定字段:
create table table1 as select id, name from table2 where 1>1;

--条件查询:
select id,name (case gender when 0 then '男' when 1 then ‘女’ end ) gender from table1

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|TaoQu.Net

GMT+8, 2024-5-9 21:53 , Processed in 0.129066 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表