Jump to content

socx

Members
  • Posts

    3
  • Joined

  • Last visited

socx's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hello,Well was giving it a trial myself and i was able to crack 1 & 2 and to the best of my knowledge a good attempt at 3.Here are my own versions.1.SELECT STUDENT.STNO, NAME, METHOD, SUM(AMT)FROM EMP, FINANCEWHERE STUDENT.STNO = FINANCE.STNO AND METHOD<>'CASH'GROUP BY METHOD, STUDENT.STNO, NAME;2.SELECT STUDENT.STNO, NAME, AMTFROM STUDENT JOIN FINANCE ON STUDENT.STNO = FINANCE.STNOWHERE AMT = (SELECT MAX(AMT) FROM FINANCE) OR AMT = (SELECT MIN(AMT) FROM FINANCE);3. For this one, I could get a single query to pull it out, but what i did was to first create a viewCREATE VIEW MYVIEW SELECT COURSE, SUM(AMT) as DSUM FROM STUDENT LEFT JOIN FINANCE ON STUDENT.STNO = FINANCE.STNO GROUP BY COURSE;And then got the requiired data from the viewSELECT MAX(DSUM) FROM MYVIEW;So I not as lazy as i seen to you.Also I tried out aspnetguy's queries on ORACLE but don't think the keyword TOP is in the ORACLE dialect.
  2. HI ALLI need to do the following using the tables STUDENT AND FINANCE BELOW.1. Find the student number, student name and total amount paid for all students that do not pay in cash.2. Find the student number, name and amount paid for the students who have made the highest and lowest individual payments3. Display the course name and total amount paid for the course that has made the most money.table : studentSTNO NAME DOB TOWN COURSE1 Joe 01-JAN-70 London Maths2 Sam 11-AUG-71 York Art3 Dave 12-DEC-69 Leeds Art4 Bob 07-JUL-68 Derby History5 Jim 02-JUN-71 London 6 Dave 02-JAN-68 Leeds Maths7 Bob 07-APR-68 Derby 8 Kim 02-FEB-71 London Mathstable: financePAY_NO AMT METHOD STNO1 100 CASH 12 150 DDEBIT 23 200 CASH 34 75 CASH 85 95 CHEQUE 46 55 CHEQUE 37 100 CHEQUE 18 150 DDEBIT 69 100 CHEQUE 3THANX A LOT,CHEERS,SOCX D'BUCK
×
×
  • Create New...