找回密码
 立即注册
查看: 404|回复: 2

Oracle数据库常用语法

25

主题

6

回帖

645

积分

管理员

金钱
589
发表于 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

0

主题

34

回帖

34

积分

新手上路

金钱
0
发表于 2024-8-7 09:13:44 | 显示全部楼层
学习了

0

主题

31

回帖

61

积分

注册会员

金钱
30
发表于 2024-8-7 15:08:02 来自手机 | 显示全部楼层
谢谢分享!!!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-9-21 06:17 , Processed in 0.040163 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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