当前位置:首页 » 编程语言 » oracle的常用sql语句

oracle的常用sql语句

发布时间: 2024-08-06 05:31:12

Ⅰ 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

Ⅱ oracle 查询数据只要排序后的第一条记录(不用rownum=1),sql语句怎么写

1、创建测试表,

create table test_order(id number, value varchar2(50));

Ⅲ 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;

结果:

热点内容
查看所有linux命令 发布:2025-05-09 09:14:16 浏览:342
王牌竞速最低要什么配置的手机 发布:2025-05-09 09:14:06 浏览:999
服务器如何飞起来 发布:2025-05-09 09:09:19 浏览:867
宣城dns的服务器地址是多少 发布:2025-05-09 09:08:38 浏览:734
安卓如何开机自动打开某应用 发布:2025-05-09 09:00:26 浏览:727
win2012服务器怎么修复 发布:2025-05-09 08:55:40 浏览:870
python产生随机数的函数 发布:2025-05-09 08:42:55 浏览:596
安卓系统和汽车连接的软件是什么 发布:2025-05-09 08:42:49 浏览:470
直接访问域名ip地址不能访问服务器吗 发布:2025-05-09 08:30:51 浏览:94
江南大学服务器地址 发布:2025-05-09 08:27:40 浏览:279