學生成績表sc
學生表student
課程表
use exercise0107;-- 資料庫的名稱
-- 第一步查詢語文,數學的課程號
select cid from course where cname="語文";
select cid from course where cname="數學";
-- 第二步分別查詢每個人的語文成績與數學成績 並給予名稱 tempchinese tempmath
select * from sc where (select cid from course where cname="語文") ;
select * from sc where (select cid from course where cname="數學") ;
-- 第三步聯合學生表查出數學成績小於語文成績的學生姓名
select student.sname from student,
(select * from sc where (select cid from course where cname="語文") ) as tempchinese,
(select * from sc where (select cid from course where cname="數學") ) as tempmath
where tempchinese.sid=student.sid and
tempchinese.sid=tempmath.sid and
tempchinese.score>tempmath.score;
mysql三表聯合查詢
select d.userid,d.userphonum,a.orderid,a.producttype,b.courseid,b.coursename,c.payje from bskgk.order info detail a join bskgk.course info b on a.prod...
mysql鏈結三個表查詢 Mysql查詢連線三個表
嘗試這個 select a.sales id,d.bus title,s.cat id from tbl sales a inner join tb sales category s on a.sales id s.sales id inner join tbl business d on a.bu...
mysql 三個表連線查詢
許可權表 permission 10 欄位名稱 型別約束 描述authorityid integer pk not null 許可權流水號id pk usernameid intnot null 使用者名稱idfk functionid integer not null 功能 idfk lookpe...