`
yonghengmoming
  • 浏览: 47314 次
  • 性别: Icon_minigender_1
  • 来自: 福州
社区版块
存档分类
最新评论

oracle数据操作篇(sql语句)

阅读更多

创建序列seq_cqyt,按1递增,从1开始递增,最小值为1(序列在数据库中很常用):
create sequence seq_cqyt increment by 1 start with 1 nomaxvalue minvalue 1;
删除序列:
drop sequence seq_cqyt;

查看指定表的字段信息:
desc CQYT1--这个是表名,要大写

往表中插入数据:
insert into cqyt1(id,username,password) values (12,'u2','p2');
insert into cqyt1 values (13,'u3','p3');    --数量和顺序必须一模一样
insert into cqyt1 values (seq_cqyt.nextval,'u4','p4')    --使用序列,使用后序列自加1
insert into cqyt1 values (seq_cqyt.currval,'u4','p4')    --使用序列,使用后序列不自加

按条件删除表中的数据:
delete from cqyt1 where id = 12 and (username='u3' || password ='p3');
按条件修改表中的数据:
update cqyt1 set password = 'p' where id=11;
按条件查询表中的数据:
select * from cqyt1 where id=11;

数据的増删改查,技术含量最高的是查,因为查询语句的好坏很多时候对网站访问速度起着非常重要的作用

关于多表查询、行转列、列转行、查询效率的提高,我将陆续补上

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics