create view test2_06 as select
a.cid,a.name,max_score,max_score2,max_score_count from(select cid,name from pub.score) a,
(select cid,max(score) max_score from pub.student_course group by cid) b,
(select 2.cid,max(1.score) max_score2 from pub.student_score 1,pub.student_score 2 where 2.cid=1.cid and 2.score<1.score group by 2.cid) c,
(select sc.cid,count(distinct sid) from pub.student_course sc,
(select cid,max(score) max_score from pub.student_course group by cid) max_sc where sc.cid=max_sc.cid and sc.score=max_sc.score) group by sc.cid) d
where a.cid=b.cid
and b.cid=c.cid
and c.cid=d.cid
uj5u.com熱心網友回復:
create view test2_06 as select
a.cid,a.name,max_score,max_score2,max_score_count from(select cid,name from pub.score) a,
(select cid,max(score) max_score from pub.student_course group by cid) b,
(select b.cid,max(a.score) max_score2 from pub.student_score a,pub.student_score b where b.cid=a.cid and b.score<a.score group by b.cid) c,
(select sc.cid,count(distinct sid) from pub.student_course sc,
(select cid,max(score) max_score from pub.student_course group by cid) max_sc where sc.cid=max_sc.cid and sc.score=max_sc.score group by sc.cid) d
where a.cid=b.cid
and b.cid=c.cid
and c.cid=d.cid
uj5u.com熱心網友回復:
請問你這個有啥區別嗎
uj5u.com熱心網友回復:
改了幾個括號的位置
uj5u.com熱心網友回復:
create view test2_06 as select
a.cid,a.name,max_score,max_score2,max_score_count from(select cid,name from pub.score) a,
(select cid,max(score) max_score from pub.student_course group by cid) b,
(select b.cid,max(a.score) max_score2 from pub.student_score a,pub.student_score b where b.cid=a.cid and b.score<a.score group by b.cid) c,
(select sc.cid,count(distinct sid) from pub.student_course sc,
(select cid,max(score) max_score from pub.student_course group by cid) max_sc where sc.cid=max_sc.cid and sc.score=max_sc.score group by sc.cid) d
where a.cid=b.cid
and b.cid=c.cid
and c.cid=d.cid
我看著沒改啊,麻煩了,本人新手
uj5u.com熱心網友回復:
create view test2_06 as select
a.cid,a.name,max_score,max_score2,max_score_count from(select cid,name from pub.score) a,
(select cid,max(score) max_score from pub.student_course group by cid) b,
(select b.cid,max(a.score) max_score2 from pub.student_score a,pub.student_score b where b.cid=a.cid and b.score<a.score group by b.cid) c,
(select sc.cid,count(distinct sid) from pub.student_course sc,
(select cid,max(score) max_score from pub.student_course group by cid) max_sc where sc.cid=max_sc.cid and sc.score=max_sc.score group by sc.cid) d
where a.cid=b.cid
and b.cid=c.cid
and c.cid=d.cid
我看著沒改啊,麻煩了,本人新手
試試就知道了
uj5u.com熱心網友回復:
又出現了表或視圖不存在,請問為什么呢
uj5u.com熱心網友回復:
又出現了表或視圖不存在,請問為什么呢
因為表或者視圖不存在……
看看庫是否選對了,視圖是否建立成功了
uj5u.com熱心網友回復:
你最好用縮進來看看你的括號是否正確
例如
create view test2_06 as
select a.cid,a.name,max_score,max_score2,max_score_count
from(
select cid,name
from pub.score
) a,(
select cid,max(score) max_score
from pub.student_course
group by cid
) b,(
select 2.cid,max(1.score) max_score2
from pub.student_score 1,pub.student_score 2
where 2.cid=1.cid and 2.score<1.score
group by 2.cid
) c,(
select sc.cid,count(distinct sid)
from pub.student_course sc,(
select cid,max(score) max_score
from pub.student_course
group by cid
) max_sc
where sc.cid=max_sc.cid and sc.score=max_sc.score
) group by sc.cid) d
where a.cid=b.cid
and b.cid=c.cid
and c.cid=d.cid
可以明顯看出,你的別名為d的子查詢,缺少左括號
uj5u.com熱心網友回復:
又出現了表或視圖不存在,請問為什么呢
因為表或者視圖不存在……
看看庫是否選對了,視圖是否建立成功了
運行出來有一行是錯誤資料
uj5u.com熱心網友回復:
你最好用縮進來看看你的括號是否正確
例如
create view test2_06 as
select a.cid,a.name,max_score,max_score2,max_score_count
from(
select cid,name
from pub.score
) a,(
select cid,max(score) max_score
from pub.student_course
group by cid
) b,(
select 2.cid,max(1.score) max_score2
from pub.student_score 1,pub.student_score 2
where 2.cid=1.cid and 2.score<1.score
group by 2.cid
) c,(
select sc.cid,count(distinct sid)
from pub.student_course sc,(
select cid,max(score) max_score
from pub.student_course
group by cid
) max_sc
where sc.cid=max_sc.cid and sc.score=max_sc.score
) group by sc.cid) d
where a.cid=b.cid
and b.cid=c.cid
and c.cid=d.cid
可以明顯看出,你的別名為d的子查詢,缺少左括號
運行出來最后一行是錯誤資料,不知道為什么
uj5u.com熱心網友回復:
你最好用縮進來看看你的括號是否正確
例如
create view test2_06 as
select a.cid,a.name,max_score,max_score2,max_score_count
from(
select cid,name
from pub.score
) a,(
select cid,max(score) max_score
from pub.student_course
group by cid
) b,(
select 2.cid,max(1.score) max_score2
from pub.student_score 1,pub.student_score 2
where 2.cid=1.cid and 2.score<1.score
group by 2.cid
) c,(
select sc.cid,count(distinct sid)
from pub.student_course sc,(
select cid,max(score) max_score
from pub.student_course
group by cid
) max_sc
where sc.cid=max_sc.cid and sc.score=max_sc.score
) group by sc.cid) d
where a.cid=b.cid
and b.cid=c.cid
and c.cid=d.cid
可以明顯看出,你的別名為d的子查詢,缺少左括號
運行出來最后一行是錯誤資料,不知道為什么
目測這里多了一個括號 ) group by sc.cid
uj5u.com熱心網友回復:
又出現了表或視圖不存在,請問為什么呢
因為表或者視圖不存在……
看看庫是否選對了,視圖是否建立成功了
運行出來有一行是錯誤資料
運行的什么,錯誤資訊是啥,總得寫出來啊
uj5u.com熱心網友回復:
麻煩各位大佬了,我真的是小菜鳥一個
以下代碼該怎末改才符合上面那個題呀?With
temp1 as (select cid max(course) max_score from pub.student_course
group by cid),
temp2 as(select cid max(course) max_score2 from pub.student_course
where temp1 group by cid),
temp3 as (select cid count(course) max_score_count from pub.student_course
where temp1 group by cid),
select cid,name,max_score,max_score2,max_score_count from pub.course,temp1,temp2,temp3
**桔妹導讀:**深耕人工智能領域,致力于探索AI讓出行更美好的滴滴AI Labs再次斬獲國際大獎,這次獲獎的專案是什么呢?一起來看看詳細報道吧! 近日,由國際計算語言學協會ACL(The Association for Computational Linguistics)舉辦的世界最具影響力的機器 ......
我們經常在資料庫中使用 LIKE 運算子來完成對資料的模糊搜索,LIKE 運算子用于在 WHERE 子句中搜索列中的指定模式。 如果需要查找客戶表中所有姓氏是“張”的資料,可以使用下面的 SQL 陳述句: SELECT * FROM Customer WHERE Name LIKE '張%' 如果需要 ......
關于MySQL的二進制日志(binlog),我們都知道二進制日志(binlog)非常重要,尤其當你需要point to point災難恢復的時侯,所以我們要對其進行備份。關于二進制日志(binlog)的備份,可以基于flush logs方式先切換binlog,然后拷貝&壓縮到到遠程服務器或本地服務器 ......