This winter holiday season, give a precious gift to your career by upgrading your skills. | Get Flat 15 - 20% OFF on All Courses | Save Today

[iqquestion id=56]

3 thoughts on “Database : Develop below SQL queries? Discussion 26

  • karim

    select first(column_name) from table_name;
    select last(column_name) from table_name;
    select max(column_name) from table_name;
    select min(column_name) from table_name;
    select sum(column_name) from table_name;

  • nasir

    AVG – function returns the average value of a numeric column
    select avg(price) as priceaverage from products;

    COUNT – function returns the number of rows that matches a specified criteria
    select count(*) as numberoforders from orders;

    FIRST – function returns the first value of the selected column
    select first(customername) as firstcustomer from customers;

    LAST – function returns the last value of the selected column
    Select last(customername) as lastcustomer from customers;

    MAX – function returns the largest value of the selected column
    select max(price) as highestprice from products;

  • Reen

    1-MIN() function returns the smallest value of the selected column
    Example:SELECT * FROM Products where Price>(select MIN(Price)from Products);
    ANS:Number of Records: 76
    select MIN(price) from products;
    ANS:2.5

    2-MAX() function returns the largest value of the selected column.
    select max(price) from products;
    ANS:263.5
    3-COUNT() function returns the number of rows that matches a specified criteria.
    EXAMPLE:
    SELECT COUNT (*)FROM Products
    ANS:77
    4-AVG() function returns the average value of a numeric column.
    select AVG(price) from products;
    ANS:28.866363636363637

    5-The SUM() function returns the total sum of a numeric column.
    SELECT SUM(Price) FROM Products
    ANS:
    2222.71

Leave a Reply