oracle經典sql
Ⅰ 求oracle長用和特有的sql語句
SELECT TO_DATE('2010-01-01','YYYY-MM-DD') + LEVEL - 1 CUR_DATE
FROM DUAL
CONNECT BY LEVEL <= TO_DATE('2010-02-10','YYYY-MM-DD') - TO_DATE('2010-01-01','YYYY-MM-DD') + 1
Ⅱ 一個簡單的oracle sql 語句
列印出空值的原因很簡單,oracle中
rownum永遠按照默認的順序生成,並且rownum只能使用<
<=,不能使用>
>=。
可以這樣寫:select
*
2
from
(select
rownum
r,e.*
3
from
(select
*
from
emp
order
by
sal)
e
4
where
rownum
<=8
5
)
6
where
r
>=5;
經過子查詢後,此時的別名r只是一個普通的欄位,就不再是按照默認生成的了
Ⅲ Oracle 經典的SQL語句,供大家參考,大家提提意見!
select × from v$sqlarea
查詢最近使用的sql語句
學習了!!
Ⅳ oracle sql語句 分為哪些
Oracle SQL語句分類
SQL(Structured Query Language)即結構化查詢語句,應用程序與資料庫交互的介面
集數據操作、數據定義、數據控制等功能於一體
ANSI先後制定推出了SQL-89、SQL-92、SQL-99標准
oracle SQL 語句主要分為一下四類:
DML(Data Mannipulation Language)數據操縱語言:查詢、操縱數據表資料行
SELECT : 檢索資料庫表或視圖數據
INSERT : 將數據行新增至資料庫表或視圖中
UPDATE : 修改表或視圖中現有的數據行
DELETE : 刪除表或視圖中現有的數據行
注意:DML語句不會自動提交事務!
DDL(Data Definition Language)數據定義語言:建立、修改、刪除資料庫中數據表對象
CREATE TABLE : 創建表
ALTER TABLE : 修改表
DROP TABLE : 刪除表
注意:DLL語句會自動提交事務!所以:DML語句事務提交之前可以回滾,DDL語句不能回滾事務
DCL(Data Control Language)數據控制語言:用於執行許可權授予與收回操作
GRANT : 給用戶或角色授予許可權
REVOKE : 收回用戶或角色的所有許可權
TCL(Transactional Control Language)事物控制語言:維護數據的一致性
COMMIT :提交已經進行的資料庫改變
ROLLBACK : 回滾已經進行的數據改變
SAVEPOINT : 設置保存點,用於部分數據改變的取消
Ⅳ ORACLE SQL語句
創建表插入數據:
createtabletest
(wy1int,
wy2int,
wy3int,
wy4int);
insertintotestvalues(1,11,4,5);
insertintotestvalues(2,22,4,6);
insertintotestvalues(3,33,4,5);
insertintotestvalues(4,444,null,null);
insertintotestvalues(5,555,null,null);
insertintotestvalues(6,666,null,null);
commit;
執行:
selectt1.wy1,t1.wy2,t2.wy2wy3,t3.wy2wy4
fromtestt1
leftjointestt2
ont2.wy1=t1.wy3
leftjointestt3
ont3.wy1=t1.wy4
orderbywy1;
結果:
Ⅵ oracle的sql語句如下
DAYS在哪?你前面雖然命名了別名,但是 TJ_XIANGMU_JIAOYIE中並沒有這個名字。要是真的想按照days分組,那麼方法是
SELECT
TO_CHAR(FABU_TIME,'yyyymmdd') AS days
FROM
TJ_XIANGMU_JIAOYIE
GROUP BY TO_CHAR(FABU_TIME,'yyyymmdd')
Ⅶ Oracle SQL經典著作除了《Oracle SQL高級編程》外,還有哪些
其實Oracle SQL最經典的不是這本書,而是《Oracle PL/SQL程序設計》不知道已經印到第幾版了,應該至少也有第五版了吧。
看了這本藐視其它相關PL/SQL書籍,哈哈,誇張了
Ⅷ oracle sql查詢語句
oracle sql查詢語句
可通過查詢all_tables這個系統表來查看資料庫中的所有表。 執行語句: select table_name from all_tables;查詢結果:
Ⅸ oracle sql 語句
1. select top 1 *from (select count(BId) as cc from brrow where getdate() between T_time and B_time group by stuID) order by cc desc
2.select a.stuname,b.title,b.T_time,b.B_time from student a join
(select borrow.stuID,borrow.T_time,borrow.B_time,book.title from borrow join book on borrow.BID=book.bid) b on a.stuID =b.stuID
3.select *from student where stuID not in (select stuid from borrow where gedate() >B_time)
4.
go
create proc login
@stuid number(10),
@password varchar2(20),
@re varchar(20) output
as
declare @st number
select @st = stuid from student where stuid=@st
if isnull(@st,0)=0 return '-1'
else if @password = (select password from student where stuid =@stuid) and @password is not null rturn '0'
else return select stuname from student where stuid =@stuid
go
5.go
create function dd()
@bid number(10)
as
if ((select bid from borrow where bid =@bid) is not null )
begin
print '必須先刪除借書信息記錄表中所有對應於該圖書的所有數據'
return
end
delete from book where bid =@bid
go