select category = --这里是什么意思啊categgory= ??这个不能理解啊
case type
when 'popular_comp' then
'popular_computing'
when 'business' then 'Business'
else 'not yet categorized'
end,
cast(title as varchar(25)) as 'shortened title' --这里也不知道怎么个意思
price as price
form titles
where price is not null
order by type,price
compute avg(price) by type --compute是什么意思啊
case type
when 'popular_comp' then
'popular_computing'
when 'business' then 'Business'
else 'not yet categorized'
end,
cast(title as varchar(25)) as 'shortened title' --这里也不知道怎么个意思
price as price
form titles
where price is not null
order by type,price
compute avg(price) by type --compute是什么意思啊
cast(title as varchar(25)) as 'shortened title' 应该是title列的内容只显示前25个字符。
compute avg(price) by type 按照type列来统计平均数。
给变量 category 赋值。------------------------------------------------------
錯誤,這怎麼是給變量賦值??這是將查詢出來的內容的列名顯示為category 。cast(title as varchar(25)) as 'shortened title'
這個是將列名顯示為'shortened title'
這是兩種不同的寫法,但是效果一樣。
--把title列转换为varchar(25)别名 'shortened titlecompute avg(price) by type 统计价格平均数