MySQL Select Query
Mysql Select Query Syntax

SELECT * | DISTINCT | col_name,col_name,col_name...

FROM table_name

WHERE where_condition

GROUP BY col_name
HAVING where_condition

ORDER BY col_name ASC | DESC

LIMIT start,totalrow

MySQL Sample Query

1- Select * from products
To Display All data from products table

2- Select * from products where Price>5000
To Display data from products table where price greater than 5000

3- SELECT * FROM products group by Columnname
To Group by Columnname

4- SELECT * FROM products group by Columnname having Price>10000
To Group by Columnname where price greater than 10000

5- SELECT * FROM products order by id desc
To Display all product in descending order by id

6- SELECT * FROM products limit 5,10
To Display all products start from 5th row and display only 10 Record

7- SELECT product_name,price FROM products WHERE quantity < 500 ORDER BY quantity ASC, price DESC;
Display product name and price where quantity less than 500 , Here quantity in ascending order and then price in descending order.

Mysql Function

This query count the total number record in student table

SELECT SUM(amount) FROM student;
This query calculate total of the amount column in student table

SELECT student_name, MAX(test_score) FROM student GROUP BY student_name;
This is first group by student name then check max score of that number and also display student name.