By : Dhirendra Chauhan
SELECT Clause
The SELECT Clause is used to select data from a database. The
data returned is stored in a result table, called the result-set.
The Select Clause Has Five Clause
1. * (Asterisk or Star)
2. Particular
3. Distinct
4. Where (Condition)
5. Order By(Asc/ Desc_
*
(Asterisk or Star)
Clause
“This clause (*) Show the all field from the Mysql Table”
Syntax Example
SELECT *
FROM table_name;
SELECT *
FROM STUDENT;
“Particular” Clause
“This clause Show the selected field from the Mysql Table”
Syntax Example
SELECT field1,field2…,fieldN
FROM table_name;
SELECT student_name
FROM STUDENT;
“Distinct” Clause
“The SELECT DISTINCT statement is used to return only distinct
(different) values.
Inside a table, a column often contains many duplicate values; and
sometimes you only want to list the different (distinct) values.”
Syntax Example
SELECT Distinct(Field)
FROM table_name;
SELECT Distinct( T_Marks)
FROM STUDENT;
“Where” Clause
“The WHERE clause is used to filter records.
The WHERE clause is used to extract only those records that
fulfill a specified condition .”
Syntax Example
SELECT *
FROM table_name
WHERE condition;
SELECT *
FROM STUDENT
WHERE T_Marks>300;
“Order By” Clause
“The ORDER BY keyword is used to sort the result-set in
ascending or descending order. The ORDER BY keyword
sorts the records in ascending order by default.
Syntax Example
SELECT *
FROM table_name
ORDER BY Field ASC|DESC;
SELECT *
FROM STUDENT
ORDER BY Marks DESC;
THANK
YOU

Select Clause

  • 1.
  • 2.
    SELECT Clause The SELECTClause is used to select data from a database. The data returned is stored in a result table, called the result-set. The Select Clause Has Five Clause 1. * (Asterisk or Star) 2. Particular 3. Distinct 4. Where (Condition) 5. Order By(Asc/ Desc_
  • 3.
    * (Asterisk or Star) Clause “Thisclause (*) Show the all field from the Mysql Table” Syntax Example SELECT * FROM table_name; SELECT * FROM STUDENT;
  • 4.
    “Particular” Clause “This clauseShow the selected field from the Mysql Table” Syntax Example SELECT field1,field2…,fieldN FROM table_name; SELECT student_name FROM STUDENT;
  • 5.
    “Distinct” Clause “The SELECTDISTINCT statement is used to return only distinct (different) values. Inside a table, a column often contains many duplicate values; and sometimes you only want to list the different (distinct) values.” Syntax Example SELECT Distinct(Field) FROM table_name; SELECT Distinct( T_Marks) FROM STUDENT;
  • 6.
    “Where” Clause “The WHEREclause is used to filter records. The WHERE clause is used to extract only those records that fulfill a specified condition .” Syntax Example SELECT * FROM table_name WHERE condition; SELECT * FROM STUDENT WHERE T_Marks>300;
  • 7.
    “Order By” Clause “TheORDER BY keyword is used to sort the result-set in ascending or descending order. The ORDER BY keyword sorts the records in ascending order by default. Syntax Example SELECT * FROM table_name ORDER BY Field ASC|DESC; SELECT * FROM STUDENT ORDER BY Marks DESC;
  • 8.