Oracle增删改查sql语句

--创建表空间
create tablespace waterboss
datafile 'd:\waterboss.dbf'
size 100m
autoextend on
next 10m

--创建用户
create user wateruser
identified by 011220
default tablespace waterboss

--给用户赋予dba权限
grant dba to wateruser

create table t_owners 
(
  id number primary key,
  name varchar2(30),
  addressid number,
  housenumber varchar2(30),
  watermeter varchar2(30),
  adddate date,
  ownertypeid number
);

create table t_ownertype
(
  id number primary key,
  name varchar2(30)
)

create table t_pricetable
(
  id number primary key,
  price number(10,2),
  ownertypeid number,
  minnum number(10,2),
  maxnum number(10,2)            
)

create table t_area
(
id number primary key,
name varchar2(30)
)

create table t_operator
(
id number primary key,
name varchar2(30)
)

create table t_address
(
id number primary key,
name varchar2(30),
areaid number,
operatorid number
)

create table t_account
(
id number primary key,
ownerid number,
ownertypeid number,
areaid number,
year char(4),
month char(4),
num0 number,
num1 number,
usenum number,
meteruserid number,
meterdate date,
money number(10,2),
isfee char(1),
feedate date,
feeuserid number
)

insert into t_ownertype(id,name) values(1,'居民');
commit;
insert into t_owners values(1,'张三丰',1,'1-1','123456',sysdate,1);
commit;
insert into t_ownertype values(3,'企业');
commit;

update t_owners set adddate=adddate-8 where id=1;
commit;

delete from t_owners where id=1;
commit;

truncate table t_ownertype

 

posted @ 2018-08-21 22:55  学亮编程手记  阅读(5127)  评论(0编辑  收藏  举报