oracle数据库的简单增删改查

来源:互联网 发布:人工智能机器人的应用 编辑:程序博客网 时间:2024/05/23 20:25

1,创建一张表

create talbe tablename(

field1 fieldtype,

field2 fieldtype

)

比如我创建的是表t1,含字段year,month,amount分别对应的字段类型varchar2(10),vcarchar2(2),float

对应的sql语句如下

create table t1(

year varchar2(10),

month varchar(5),

amount float

)

2,同时插入多条记录,oracle这里跟sqlserver有差异

格式如下

insert all

into t1(year,month,amount) values(2001,1,1.1)

into t1(year,month,amount) values(2001,2,1.2)

into t1(year,month,amount) values(2001,3,1.3)

into t1(year,month,amount) values(2001,4,1.4)

select 1 from dual--前面类似,最后这句固定就ok

3,修改字段名

alter table t1 rename column amount to count--将字段amount修改为count

4,查询

select * from t1--查询全部的字段信息

5,修改某个字段的值

update t1 set year=2002 where  month=4 and amount=1.4--将where条件满足情况下的修改year值

by Tmall coupon towww.591q.cn 






原创粉丝点击