create procedure xp_lucky_programe_1
@username nvarchar(20),
@int_big_class int
as --收藏總的節目總數
declare @count_program int
select @count_program=count(*)
from walkradio
where
w_username=@username
if(@count_program>=1)
begin
--收藏的類別總數(按大類計算)
declare @count_big_class int
select @count_big_class=count(distinct p_big_class)
from program_info,walkradio
where
program_info.program_id=walkradio.p_id
and w_username= @username
--計算某個類別的節目總數在總的節目數的比例
declare @int_property decimal(5,2)
declare @sqlstr nvarchar(1000)
declare @exec_sql nvarchar(1000)
declare @exec_sql_1 nvarchar(1000)
set @exec_sql_1=''
declare @select_count_programe int --應該挑選的節目數
declare @p_big_class int
declare @i int
declare @x int
declare @postion cursor
set @postion = cursor scroll for
--每個類別對應的節目總數和類別名稱
select distinct count(*) as lucky_count,p_big_class
from program_info,walkradio
where
program_info.program_id=walkradio.p_id
and
w_username=@username
group by(p_big_class)
open @postion
fetch next from @postion into @x,@p_big_class
set @i=1
while(@i<
=@count_big_class)
begin
set @int_property=0.1*12*@x/@count_program
set @select_count_programe=ceiling(@int_property*10)
set @sqlstr='select top '+ convert(varchar(10),@select_count_programe) + ' * from good_progrm where p_big_class='+convert(varchar(10),@p_big_class)
set @exec_sql_1=@exec_sql_1+@sqlstr+' union '
--到了最後 就不再加 union這個關鍵字
if(@i=@count_big_class)
begin
set @exec_sql_1=@exec_sql_1+@sqlstr
end
fetch next from @postion into @x,@p_big_class
set @i=@i+1
end
close @postion
set @exec_sql='select * from( '
set @exec_sql=@exec_sql+@exec_sql_1
set @exec_sql=@exec_sql+') b where program_id not in (select walkradio.p_id from walkradio where
w_username='''+@username+''') and p_big_class ='+convert(varchar(10),@int_big_class)+'order by p_see_count desc,program_id desc'
exec (@exec_sql)
end
else
begin
print '你沒有收藏節目'
select top 3 * from good_progrm where
p_big_class=@int_big_class order by p_see_count desc
endgo
計算機的主存和輔存
計算機的主存是指下邊兩個 1.ram random access memory 隨機存取儲存器,即我們電腦的記憶體條 2.rom read only memory 只讀儲存器,這種儲存器用途比較少,一般就是電腦中存放boot的地方,我們啟動電腦的時候,電腦先讀rom中的內容,比如我們的bios系統,...
使用擴充套件SRAM設計的存內計算
最近的isscc上,臺積電的研究人員提出了一種基於數字改良的sram設計存內計算方案,能支援更大的神經網路.上圖顯示了臺積電用於其測試的擴充套件sram陣列配置 陣列的一部分被圈出。每個切片具有256個資料輸入,它們連線到 x 邏輯 稍後將對此邏輯進行更多介紹 資料輸入向量的連續位在連續的時鐘週期中...
判定程式屬於計算密集和訪存密集的方法
分析程式是計算密集 compute intensive 還是訪存密集 memory intensive 1 算出機器的單核峰值效能 主頻 simd寬度 2 如果存在乘加指令 cpupeak 2 測出機器峰值頻寬 用streaming測出實際頻寬峰值,但是該峰值是所有處理器核的總和,需要除以實際物理核...
存款利息的計算。有1000元,想存5年
存款利息的計算。有1000元,想存5年,可按以下5種方法存 1 一次存5年期。2 先存2年期,到期後將本息再存3年期。3 先存3年期,到期後將本期再存2年期。4 存1年期,到期後將本息再存1年期,連續存5次。5 存活期存款。活期利息每一季度結算一次。2007年12月的銀行存款利息如下 1年期定期存款...
我的計算幾何學題目分類
uva11646 sdutoj2603 poj1269 poj1410 poj1328 貪心 uva12304 三角 圓基本關係 poj1556 線段相交 最短路 poj2966 凸包 最短路 poj2031 最小生成樹 poj2318 poj2398 二分 hdu1086 基礎 poj2007 極...