Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 46

Thread: SQL Quiz!

  1. #11
    Junior Member
    Join Date
    Jun 2005
    Gender
    Male
    Posts
    285

    Default Re: SQL Quiz!


    Do subqueries work on MYSQL?

  2. #12

    Default Re: SQL Quiz!

    Quote Originally Posted by kyle_nexus
    SELECT dept, SUM(salary) AS Expr1
    FROM table1
    WHERE (dept = 'IT')
    GROUP BY dept

    ngano gi-group mani bai? wa pa kau ko ka-g sa concept sa group by. nsa d i mahitabo if dili i-group by?

  3. #13
    Junior Member
    Join Date
    Jun 2005
    Gender
    Male
    Posts
    285

    Default Re: SQL Quiz!

    di ba kinahanglan nimo igroup bai basta naa ka aggregate functions?

  4. #14

    Default Re: SQL Quiz!

    Quote Originally Posted by kobmat
    Do subqueries work on MYSQL?
    yes subqueries works in mySQL

  5. #15
    Junior Member
    Join Date
    Jun 2005
    Gender
    Male
    Posts
    285

    Default Re: SQL Quiz!

    unsa na version bai... last time i tried on mysql 3.23 it does not work

  6. #16

    Default Re: SQL Quiz!

    Quote Originally Posted by red_colt
    Quote Originally Posted by kyle_nexus
    SELECT dept, SUM(salary) AS Expr1
    FROM table1
    WHERE (dept = 'IT')
    GROUP BY dept

    ngano gi-group mani bai? wa pa kau ko ka-g sa concept sa group by. nsa d i mahitabo if dili i-group by?
    SELECT dept, SUM(salary) AS Expr1
    FROM table1
    WHERE (dept = 'IT')
    GROUP BY dept

    bai redcolt,
    in the above sql statement, group by is a required clause because it includes an aggregate
    function SUM for salary field. Remember it selects two columns dept and salary field is already SUM up meaning the result for salary field is only 1 Row (kay naka sum naman) , with this you need also to GROUP the dept field para 1 row ra pud ang result. If dili naka group ang dept you will encounter an error with the statement.

  7. #17

    Default Re: SQL Quiz!

    Quote Originally Posted by kobmat
    unsa na version bai... last time i tried on mysql 3.23 it does not work
    im using the GNU version 5 of mySQL (just check mysql.com) . ngita lagi ko higher version pero naay daghan pirated or you have to buy the licenced medyo mahal.

    bai we encourage you and ur friend to answer the lastest sql quiz above para ma mag move mi
    thanks

  8. #18
    Junior Member
    Join Date
    Jun 2005
    Gender
    Male
    Posts
    285

    Default Re: SQL Quiz!

    Sakto ni bai?

    SELECT MONTH(ORDERS_H.TRANSACTION_DATE) AS MON,
    CUSTOMER.CUSTOMER_NAME,
    SUM(ORDERS_D.SELLING_PRICE) AS TOTAL_PURCHASES
    FROM ORDERS_D, ORDERS_H, CUSTOMER
    WHERE ORDERS_D.RECORD_NO = ORDERS_H.RECORD_NO AND
    ORDERS_H.CUSTOMER_CODE = CUSTOMER.CUSTOMER_CODE
    GROUP BY MON, ORDERS_H.CUSTOMER_CODE;

  9. #19

    Default Re: SQL Quiz!

    Quote Originally Posted by kobmat
    Sakto ni bai?

    SELECT MONTH(ORDERS_H.TRANSACTION_DATE) AS MON,
    CUSTOMER.CUSTOMER_NAME,
    SUM(ORDERS_D.SELLING_PRICE) AS TOTAL_PURCHASES
    FROM ORDERS_D, ORDERS_H, CUSTOMER
    WHERE ORDERS_D.RECORD_NO = ORDERS_H.RECORD_NO AND
    ORDERS_H.CUSTOMER_CODE = CUSTOMER.CUSTOMER_CODE
    GROUP BY MON, ORDERS_H.CUSTOMER_CODE;
    bai kobmat, let have otis validate your answer kay siya man ang ni post the question...Otis asa naman ka ?

    part post na sa imong next SQL question..ika number 5 na

  10. #20

    Default Re: SQL Quiz!

    Quote Originally Posted by kobmat
    Sakto ni bai?

    SELECT MONTH(ORDERS_H.TRANSACTION_DATE) AS MON,
    CUSTOMER.CUSTOMER_NAME,
    SUM(ORDERS_D.SELLING_PRICE) AS TOTAL_PURCHASES
    FROM ORDERS_D, ORDERS_H, CUSTOMER
    WHERE ORDERS_D.RECORD_NO = ORDERS_H.RECORD_NO AND
    ORDERS_H.CUSTOMER_CODE = CUSTOMER.CUSTOMER_CODE
    GROUP BY MON, ORDERS_H.CUSTOMER_CODE;
    Sorry for the late reply, I've been busy sa work.

    Yes, I believe that's correct.. pero
    GROUP BY MON
    wouldn't work in MS SQL Server.

    GROUP BY MONTH(ORDERS_H.TRANSACTION_DATE) would work or you could create a derived table having MON as a column ;D

  11.    Advertisement

Page 2 of 5 FirstFirst 1234 ... LastLast

Similar Threads

 
  1. o0 World's Easiest Quiz 0o
    By digital_pimpette in forum General Discussions
    Replies: 45
    Last Post: 12-02-2012, 07:47 PM
  2. SQL 101
    By BadDudes in forum Programming
    Replies: 44
    Last Post: 08-31-2012, 07:34 AM
  3. Tabangi ko plssss....PL/SQL Tuning Tips
    By zengatsu in forum Programming
    Replies: 13
    Last Post: 06-29-2006, 08:20 PM
  4. wat's d best sql back-end?
    By edshark in forum Software & Games (Old)
    Replies: 5
    Last Post: 09-15-2005, 04:41 PM
  5. HOW TO CONNECT SQL SERVER USING SQL AUTHENTICATION
    By edshark in forum Software & Games (Old)
    Replies: 13
    Last Post: 09-02-2005, 04:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top