--创建新表
create table tableName(
tid number primary key,
tname varchar(20) not null
)
--创建序列
create sequence seq_tableName
start with 1
increment by 1;
--添加数据
insert into tableName(tid,tname) values(seq_tableName.nextval,'张三');
--更新数据
update tableName set tname = "mary" where tname = "张三";
--删除数据
1.删除一条数据
delete tableName where tname ="张三"
2.删除多条数据(用点连接查询,以后会介绍关于连接查询方面的)
delete tableName where tname(
select tname from tableName
)
--删除表
drop table tableName;
--修改表名
alter table tableName rename to tableName1
--表数据的复制
insert into tableName as (select * from table1)
--复制表结构
create table tableName3 as select * from tableName where 1=2;
--复制指定的字段
create table tableName3 as select tname,sex from tableName where 1=2;
--条件查询
select id ,name (case sex when 0 then '男' when 1 then '女' end if) as sex from tableName3
--查询某个人的信息
select id,name,( case sex when 0 then '男' whem 1 then '女' end if) as sex from tableName3 where name ='Mary'