![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SQl
xzquan
这个作者很懒,什么都没留下…
展开
-
SQl 常用一些命令写法
都是基础的,自已的笔记.自已看 Oracle 中 空表 为 dual表,用于常用计算的 如: select 5+5 from dual //显示是10 Oracle 中 表示当前时间的是sysdate(1)查询唯一记录关键字:distinct例子:select distinct name from head; //查出name字段唯一值的记录查询重复记录 select name from ...2008-06-17 18:50:31 · 155 阅读 · 0 评论 -
各种数据库的简单逻辑处理
Access中用 select IIF([字段]=0,'男',IIF([字段]=1,'女')) as 别名 from table,而且我们可以加入更丰富的处理, SqlServer中用 select case when 字段=0 then '男' else '女' end as 别名 from table Oracle中和SqlServer语法类似 select case when 字段=0 th...原创 2008-06-23 19:00:04 · 536 阅读 · 0 评论 -
Oracle Plsql
语法和delphi差不多 变量声明使用declare 例子: declare v_name varchar2(10); ...begn....end 自定义类型: 例子: type mydefine is table of head.id%type index by binary_integer; declare v_id my...2008-06-23 18:41:57 · 88 阅读 · 0 评论 -
Oracle序列
建立 create sequence sq;//建立一个叫sq的序列 然后就可以使用这个序列了 如在stu表中添加自增型的id值 insert into stu (id) values(sq.nextval);//2008-06-23 17:25:07 · 97 阅读 · 0 评论 -
Oracle索引
建立 create index idx_name on head (name); 删除 drop index idx_name; 索引的优点和缺点:访问快,添加信息慢2008-06-23 17:11:36 · 71 阅读 · 0 评论 -
Oracle查询数据表
查询当前用户有哪些表 select table_name from user_tables; 查询当前用户有哪些视图 select view_name from user_views; 查询当前用户有哪些约束 select canstraint_name from user_constraints;...2008-06-23 17:00:41 · 91 阅读 · 0 评论 -
Oracle约束
一种写法: 字段级约束 create table mytable (id number primary key,uname varchar2(10) canstraint a_unique,,age number(3) canstraint a_not_null not null,,email varchar2(20) canstraint a_email_unique)...2008-06-23 15:44:54 · 101 阅读 · 0 评论 -
SqlServer 分页语句
两种:(1): select top 20 name from table where id> (select max(id) from (select top 20*3 name from table order by id) ) (2) :select top 20 name form table where id no...2008-06-23 14:58:18 · 67 阅读 · 0 评论 -
Oracle分页语句
例子: select name from ( select name,rownum r ( ...2008-06-20 17:01:41 · 76 阅读 · 0 评论 -
Oracle的启动
可先启动服务,也可以先启动listener,1 启动listenner.lsnrctl start 2 启动服务 sqlplus /nologconn /as sysdbastartup 3查看是否启动oracle服务ps -ef |grep oracle...2009-08-17 22:36:20 · 78 阅读 · 0 评论