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 to www.591q.cn