MySQL Database Tutorial – 18 – More on Aggregate Functions




Facebook – https://www.facebook.com/TheNewBoston-464114846956315/ GitHub – https://github.com/buckyroberts Google+ …

Original source


36 responses to “MySQL Database Tutorial – 18 – More on Aggregate Functions”

  1. I have a problem, when I order the database by the price, I should get the used car (id=33) as the maximum, however it appears in the middle:

    Linkbuzz | 582.75 | 67 | 49
    Muxo | 580.62 | 4 | 18
    used car | 5700.5 | 12 | 50
    Topicware | 549.39 | 3 | 11

    It seams that it takes 5700.5 as 570.05 but why?

  2. Hey Bucky… I've got a question for you… I used a "," after "avg" on the third row and it didn't work. Why is that?
     
    SELECT COUNT(*) AS item_count,
    MAX(cost)AS max,
    AVG(cost)AS avg              <—————
    FROM items WHERE seller_id=12

  3. DISTINCT SELECT DISTINCT name FROM customers

    LIMIT SELECT name, zip FROM customers LIMIT 5, 10

    OREDR BY SELECT name, id, address, state FROM customers ORDER BY state, name
    SELECT name, id, address, state FROM customers ORDER BY state DESC
    SELECT name, id, address, state FROM customers ORDER BY state DESC LIMIT 5

    * SELECT * FROM customers

    qualified name SELECT name. Address FROM customers

  4. Hmmm, couldn't get this query to work. Error in ln 4 Where seller_id=12. Here's a paste of my commands, see if you can spot the error please???
    SELECT COUNT(*) AS item_count,
    MAX(cost) AS max,
    AVG(cost) AS avg,
    FROM items WHERE seller_id=12

Leave a Reply