|
ᶥₒᶛₓ
|
 |
« Reply #60 on: 23 February, 2010, 23:00:16 » |
|
select table.. 
|
Internet. Serious Business.
|
|
|
|
wappenok
|
 |
« Reply #61 on: 23 February, 2010, 23:02:14 » |
|
ข้อ 44 ผมคิดมาแบบนี้ มันไม่ตรงกะของพี่(เค้าใช้ sub query) ใครก็ได้เอาไปเทสให้หน่อยสิ ตอบเหมือนกันป่าวอะ  select president,count(*)- from president,administration- where president.name = administration.name- and year_inaugurated > 1850- group by party- having count(*) > 7 select president,count(*)เราไม่ได้ใช้โปรแกรม..เพราะไม่ทันแบ้ว 5555 . เพิ่งอ่าน แต่ นี่น่าจะ syntax "เอ เร่อ" เพราะ ถ้า group by party แล้ว set อยู่กับ build-in fn ? ข้อ 44 ถาม which party ? แต่นาย select อะไรอ่า ชื่อ table? งง select column name มะใช่หรอ select president,count(*) - from president,administration - where president.pres_name = administration.pres_name - and year_inaugurated > 1850 - group by party - having count(*) > 7 ได้ดังนี้ ?? SELECT PRESIDENT,COUNT(*) - FROM PRESIDENT,ADMINISTRATION - WHERE PRESIDENT.PRES_NAME = ADMINISTRATION.PRES_NAME - AND YEAR_INAUGURATED > 1850 - GROUP BY PARTY - HAVING COUNT(*) > 7 ARI503E AN SQL ERROR HAS OCCURRED. A PORTION OF THE COMMAND IS INVALID NEAR TO OR INVOLVING: PRESIDENT, COUNT(*) FROM PRESIDENT,ADMINISTRATION WHERE PRESIDENT.PRES_NAME = ADMINISTRATION.PRES_NAME AND YEAR_INAUGURATED > 1850 GROUP BY PARTY HAVING COUNT(*) > 7. SQLCODE = -104 ROWCOUNT = 0 คิดว่า ตรง select น่าจะผิดมั้งครับ ?
|
|
|
|
|
|
ยัยคิ้ม เดอะ มอ ลาดกระบัง
|
 |
« Reply #62 on: 23 February, 2010, 23:08:53 » |
|
อย่าไปกลัว SQL 25 คะแนนเอง 
|
ถึงแม้เมื่อใดที่ "ใจเรา" หายไปจากกาย แต่ "กายเรา" ก็ยังต้องการ "ลมหายใจ" ...เสมอ
|
|
|
|
wappenok
|
 |
« Reply #63 on: 23 February, 2010, 23:11:31 » |
|
(แถมก่อนสอบ !!!! ข้อนี้รุ่นพี่ไม่เฉลยให้) ๘๔. Which candidate gained presidency in which election with the largest margin. Show the next highest candidate their votes and the percentage of winner votes to total votes. ปธน ท่านใด ได้รับชนะในการเลือกตั้งโดยที่ผลต่างระหว่างคะแนนชนะกับคะแนนเสียงส่วนใหญ่มากที่สุด (ชนะขาดลอยที่สุด) แสดงชื่อคนที่ได้อันดับสอง คะแนนที่ได้ และเปอร์เซ็นต์ของคะแนนเสียงผู้ชนะต่อคะแนนทั้งหมด select candidate, votes, 100.0*votes/(select sum(votes) from election where election_year = - (select election_year from election group by election_year having 1.0*max(votes)/sum(votes) >= all - (select 1.0*max(t2.votes)/sum(t2.votes) from election t2 group by t2.election_year ))) - from election - where election_year = (select election_year from election group by election_year having 1.0*max(votes)/sum(votes) >= all - (select 1.0*max(t2.votes)/sum(t2.votes) from election t2 group by t2.election_year )) - and votes >= - (select max(votes) from election where election_year = - (select election_year from election group by election_year having 1.0*max(votes)/sum(votes) >= all - (select 1.0*max(t2.votes)/sum(t2.votes) from election t2 group by t2.election_year )) and votes < - (select max(votes) from election where election_year = - (select election_year from election group by election_year having 1.0*max(votes)/sum(votes) >= all - (select 1.0*max(t2.votes)/sum(t2.votes) from election t2 group by t2.election_year ))))
CANDIDATE VOTES 100.0*VOTES/(SELECT SUM(VOTES) ---------------- ------ ------------------------------ Monroe J 231 9.9568965517241387885860E+001 Adams J Q 1 4.3103448275862064065222E-001 * END OF RESULT ***** 2 ROWS DISPLAYED ****************************************
โอ้ sub-query 4 ชั้น ช็อค........  ได้ผลลัพธ์มา 2 บรรทัด คิดว่ามีวิธีที่สั้นกว่านี้ ครอกกกก อ้างอิง : จากตาราง election มีปี 1820 อยู่ปีเดียวที่คะแนนผู้ชนะขาดลอยสุด ๆ คือ มีคนลงสมัครแค่ 2 คน คะแนน 231 ต่อ 1 เสียง ปล. อีกนัยหนึ่ง หลังจากมาอ่านโจทย์อีกรอบ คิดว่า โจทย์ต้องการถามเฉพาะ "ใครได้ที่ 2" กับ "ที่หนึ่งได้กี่เปอเซนมากกว่า" ไม่แน่ใจนะครับ
|
|
|
|
|
|
ชิวเกิ๊นน
|
 |
« Reply #64 on: 23 February, 2010, 23:12:35 » |
|
ข้อ 44 ผมคิดมาแบบนี้ มันไม่ตรงกะของพี่(เค้าใช้ sub query) ใครก็ได้เอาไปเทสให้หน่อยสิ ตอบเหมือนกันป่าวอะ  select president,count(*)- from president,administration- where president.name = administration.name- and year_inaugurated > 1850- group by party- having count(*) > 7 เราไม่ได้ใช้โปรแกรม..เพราะไม่ทันแบ้ว 5555 . เพิ่งอ่าน select president,count(*) อันแรกก็งงละ คิดว่าจะ select pres_name ปะ ???????? ถ้า select pres_name นี่น่าจะ syntax "เอ เร่อ" เพราะ ถ้า group by party แล้ว set อยู่กับ build-in fn ? ข้อ 44 ถาม which party ? แต่นาย select อะไรอ่า ชื่อ table? งง select column name มะใช่หรอ ปล. นายส่ง ไวรัส มาเข้าสมองเราป่าววะ เสียเซ้ว เลย งง5 5.  เขียนผิดๆ ต้อง Select party สิเค้าถาม party ต้อง select party,count(*)- from pesident,administration- where president.name = administration.name- and year_inaugurated > 1850- group by party- having count(*) > 7
|
|
|
|
|
vertical
Guest
|
 |
« Reply #65 on: 23 February, 2010, 23:14:27 » |
|
(แถมก่อนสอบ !!!! ข้อนี้รุ่นพี่ไม่เฉลยให้) ๘๔. Which candidate gained presidency in which election with the largest margin. Show the next highest candidate their votes and the percentage of winner votes to total votes. ปธน ท่านใด ได้รับชนะในการเลือกตั้งโดยที่ผลต่างระหว่างคะแนนชนะกับคะแนนเสียงส่วนใหญ่มากที่สุด (ชนะขาดลอยที่สุด) แสดงชื่อคนที่ได้อันดับสอง คะแนนที่ได้ และเปอร์เซ็นต์ของคะแนนเสียงผู้ชนะต่อคะแนนทั้งหมด select candidate, votes, 100.0*votes/(select sum(votes) from election where election_year = - (select election_year from election group by election_year having 1.0*max(votes)/sum(votes) >= all - (select 1.0*max(t2.votes)/sum(t2.votes) from election t2 group by t2.election_year ))) - from election - where election_year = (select election_year from election group by election_year having 1.0*max(votes)/sum(votes) >= all - (select 1.0*max(t2.votes)/sum(t2.votes) from election t2 group by t2.election_year )) - and votes >= - (select max(votes) from election where election_year = - (select election_year from election group by election_year having 1.0*max(votes)/sum(votes) >= all - (select 1.0*max(t2.votes)/sum(t2.votes) from election t2 group by t2.election_year )) and votes < - (select max(votes) from election where election_year = - (select election_year from election group by election_year having 1.0*max(votes)/sum(votes) >= all - (select 1.0*max(t2.votes)/sum(t2.votes) from election t2 group by t2.election_year ))))
CANDIDATE VOTES 100.0*VOTES/(SELECT SUM(VOTES) ---------------- ------ ------------------------------ Monroe J 231 9.9568965517241387885860E+001 Adams J Q 1 4.3103448275862064065222E-001 * END OF RESULT ***** 2 ROWS DISPLAYED ****************************************
โอ้ sub-query 4 ชั้น ช็อค........  ได้ผลลัพธ์มา 2 บรรทัด คิดว่ามีวิธีที่สั้นกว่านี้ ครอกกกก อ้างอิง : จากตาราง election มีปี 1820 อยู่ปีเดียวที่คะแนนผู้ชนะขาดลอยสุด ๆ คือ มีคนลงสมัครแค่ 2 คน คะแนน 231 ต่อ 1 เสียง อ่าว จดๆๆๆๆๆๆ ขี้เกียจคิด+คิดไม่ออก จดๆๆๆๆ
|
|
|
|
|
|
P&P
|
 |
« Reply #66 on: 23 February, 2010, 23:19:06 » |
|
^ ^ ^ เยอะขนาดนั้นไม่ออกหรอกมั้ง ตายพอดี  ปล. กลายยเป็นกระทู้ DB ในตำนานไปแล้ว 
|
วันนี้... คุณใส่ใจความรู้สึก ของคนที่คุณรัก... มากพอหรือยัง <-- ใส่ใจไปก็เท่านั้น  Harman/Kardon SoundStick II + Creative Sound Blaster X-Fi XtremeMusic
|
|
|
|
ยัยคิ้ม เดอะ มอ ลาดกระบัง
|
 |
« Reply #67 on: 23 February, 2010, 23:20:12 » |
|
ใช้ SQL ใน window 7 ยังไงอ่ะ อยากลองม้างๆ ใครรู้ตอบด้วยคร้าบๆๆ
|
ถึงแม้เมื่อใดที่ "ใจเรา" หายไปจากกาย แต่ "กายเรา" ก็ยังต้องการ "ลมหายใจ" ...เสมอ
|
|
|
F-22 Raptor
Freshy
   
คะแนนจิตพิสัย 17
Offline
Gender: 
Posts: 4217
ตากล้อง ต้องเกรียน
|
 |
« Reply #68 on: 23 February, 2010, 23:22:46 » |
|
หาลง xp mode
ไม่ก็หาเครื่อง ที่มี xp
โชคดี เรามีเครื่องลง xp
|
  "ไม่ใช่เพียง เก็บแสงสี ที่สาดส่อง ไม่ใช่เพียง คนเล่นกล้อง ประลองฝัน" "ไม่มีคำว่าเป็นไม่ได้ ในพจนานุกรมของผม เป็นไปไม่ได้ ทำไม่ได้ หรือไม่ได้ทำ" Johnnie Walker (บักจอนย่าง) "I am a slow walker,but I never walk backwards "
|
|
|
|
ยัยคิ้ม เดอะ มอ ลาดกระบัง
|
 |
« Reply #69 on: 23 February, 2010, 23:25:54 » |
|
หาลง xp mode
ไม่ก็หาเครื่อง ที่มี xp
โชคดี เรามีเครื่องลง xp
ไม่มีอ่า T^T
|
ถึงแม้เมื่อใดที่ "ใจเรา" หายไปจากกาย แต่ "กายเรา" ก็ยังต้องการ "ลมหายใจ" ...เสมอ
|
|
|
as12df
น้องใหม่พูดคุย
คะแนนจิตพิสัย 2
Offline
Posts: 43
|
 |
« Reply #70 on: 24 February, 2010, 08:35:06 » |
|
(แถมก่อนสอบ !!!! ข้อนี้รุ่นพี่ไม่เฉลยให้) ๘๔. Which candidate gained presidency in which election with the largest margin. Show the next highest candidate their votes and the percentage of winner votes to total votes. ปธน ท่านใด ได้รับชนะในการเลือกตั้งโดยที่ผลต่างระหว่างคะแนนชนะกับคะแนนเสียงส่วนใหญ่มากที่สุด (ชนะขาดลอยที่สุด) แสดงชื่อคนที่ได้อันดับสอง คะแนนที่ได้ และเปอร์เซ็นต์ของคะแนนเสียงผู้ชนะต่อคะแนนทั้งหมด select candidate, votes, 100.0*votes/(select sum(votes) from election where election_year = - (select election_year from election group by election_year having 1.0*max(votes)/sum(votes) >= all - (select 1.0*max(t2.votes)/sum(t2.votes) from election t2 group by t2.election_year ))) - from election - where election_year = (select election_year from election group by election_year having 1.0*max(votes)/sum(votes) >= all - (select 1.0*max(t2.votes)/sum(t2.votes) from election t2 group by t2.election_year )) - and votes >= - (select max(votes) from election where election_year = - (select election_year from election group by election_year having 1.0*max(votes)/sum(votes) >= all - (select 1.0*max(t2.votes)/sum(t2.votes) from election t2 group by t2.election_year )) and votes < - (select max(votes) from election where election_year = - (select election_year from election group by election_year having 1.0*max(votes)/sum(votes) >= all - (select 1.0*max(t2.votes)/sum(t2.votes) from election t2 group by t2.election_year ))))
CANDIDATE VOTES 100.0*VOTES/(SELECT SUM(VOTES) ---------------- ------ ------------------------------ Monroe J 231 9.9568965517241387885860E+001 Adams J Q 1 4.3103448275862064065222E-001 * END OF RESULT ***** 2 ROWS DISPLAYED ****************************************
โอ้ sub-query 4 ชั้น ช็อค........  ได้ผลลัพธ์มา 2 บรรทัด คิดว่ามีวิธีที่สั้นกว่านี้ ครอกกกก อ้างอิง : จากตาราง election มีปี 1820 อยู่ปีเดียวที่คะแนนผู้ชนะขาดลอยสุด ๆ คือ มีคนลงสมัครแค่ 2 คน คะแนน 231 ต่อ 1 เสียง ปล. อีกนัยหนึ่ง หลังจากมาอ่านโจทย์อีกรอบ คิดว่า โจทย์ต้องการถามเฉพาะ "ใครได้ที่ 2" กับ "ที่หนึ่งได้กี่เปอเซนมากกว่า" ไม่แน่ใจนะครับ 200กว่าได้9.9 1ได้ 4.3 มันคืออะไรทำไมมันใกล้กันจังอะ
|
|
|
|
|
|
ชิวเกิ๊นน
|
 |
« Reply #71 on: 24 February, 2010, 16:35:15 » |
|
 ตอนทำมั่นใจ sql ทุกข้อ ออกมาผิดโง่ไปแล้ว 3 ER ก็เขียนไปนิดเดียวทำไม่ทัน ตอบคำถามก็โดนหลอก อยากได้ C+ จัง 
|
|
|
|
ᵺ
พี่เล็กตอบโต้
 
คะแนนจิตพิสัย 0
Offline
Posts: 172
☝ (tomodachi)
|
 |
« Reply #72 on: 24 February, 2010, 16:49:55 » |
|
SQL ก็รู้สึกเหมือนว่าจะทำได้ แต่ไม่ได้เช็คกับคนอื่นว่าถูกไม่ถูก... แต่ก็รู้สึกว่าไม่ได้ยากแบบหลาย ๆ ข้อใน 90 ข้อพวกนี้นะ ป.ล. ติดข้อนับจำนวน Hobby นานมาก กลัวโดนดัก 
|
/home/ᵺ/
|
|
|
|
FAIRLADYZ
|
 |
« Reply #73 on: 24 February, 2010, 16:58:33 » |
|
SQL ก็รู้สึกเหมือนว่าจะทำได้ แต่ไม่ได้เช็คกับคนอื่นว่าถูกไม่ถูก... แต่ก็รู้สึกว่าไม่ได้ยากแบบหลาย ๆ ข้อใน 90 ข้อพวกนี้นะ ป.ล. ติดข้อนับจำนวน Hobby นานมาก กลัวโดนดัก  เหมือนกันเลย ดันมาอยู่ข้อย่อย 4 ท่ามกลางข้อโหดๆ แอบเกร็งไปนานอยู่
|
ขอขอบคุณสำหรับทุกๆท่านที่กดคะแนนจิตพิศัยให้ผมและเข้ามาอ่านข่าว ^^
|
|
|
|
ยัยคิ้ม เดอะ มอ ลาดกระบัง
|
 |
« Reply #74 on: 24 February, 2010, 17:53:07 » |
|
แนวข้อสอบ DB ปีล่าสุด เพิ่มเติมกันเองนะ จำไม่ค่อยได้  ปล. จารย์คะ หนูขอ B ก็พอคะ T^T
|
ถึงแม้เมื่อใดที่ "ใจเรา" หายไปจากกาย แต่ "กายเรา" ก็ยังต้องการ "ลมหายใจ" ...เสมอ
|
|
|
|
wappenok
|
 |
« Reply #75 on: 24 February, 2010, 21:02:34 » |
|
ชอค... ถามเกี่ยวกับนิยามกะทฤษฎีก็ 20 40 คะแนนเข้าไปแล้ว .....  อย่าต่ำกว่า C+ เล้ย..
|
|
|
|
|
|
P&P
|
 |
« Reply #76 on: 24 February, 2010, 21:08:17 » |
|
|
วันนี้... คุณใส่ใจความรู้สึก ของคนที่คุณรัก... มากพอหรือยัง <-- ใส่ใจไปก็เท่านั้น  Harman/Kardon SoundStick II + Creative Sound Blaster X-Fi XtremeMusic
|
|
|
|
ชิวเกิ๊นน
|
 |
« Reply #77 on: 24 February, 2010, 21:30:26 » |
|
โดนหลอก relation กะ relationship ด้วยอะ  แง้รู้ทั้งรู้ รีบทำอะทำไม่ทัน อ่านข้ามไปเลย กรี๊ดดด อยากจะร้องไห้เป็นภาษา ไพทรอน  >>> for i in range(100): print 
|
|
|
|
|
ยัยคิ้ม เดอะ มอ ลาดกระบัง
|
 |
« Reply #78 on: 24 February, 2010, 22:17:15 » |
|
ชอค... ถามเกี่ยวกับนิยามกะทฤษฎีก็ 20 40 คะแนนเข้าไปแล้ว .....  อย่าต่ำกว่า C+ เล้ย.. ถ้าข้อนิยามกะทฤษฎีทำได้หมด หมายถึงเต็ม 40 คะแนน จะได้เกรดเท่าไรหรอ ขออย่างต่ำ
|
ถึงแม้เมื่อใดที่ "ใจเรา" หายไปจากกาย แต่ "กายเรา" ก็ยังต้องการ "ลมหายใจ" ...เสมอ
|
|
|
|
Tee
|
 |
« Reply #79 on: 25 February, 2010, 09:54:58 » |
|
เกรดไม่ต้องห่วงหรอก แค่ทำนิยามได้ ก็สบายๆ ไปละ C ขึ้นแน่นอน นั่นแปลว่า เข้าเรียนไม่มีทาง D หรือ F
|
|
|
|
|
|