SQL SELECT

Select statement is used to fetch data from a table.

Mainly the data is fetched by two ways using select statement.

  1. Fetching the specific column/columns only, and
  2. Fetching whole data of table.

Fetching the specified columns

To fetch specific column/columns the columns are mentioned as the following syntax 

Syntax:

SELECT column1, column2 FROM table_name;

Example: To fetch Roll_No and and name from the table students

SELECT Roll_No, Name FROM students;

This will fetch the values as shown below:

Fetching the whole data from table

Syntax:

SELECT * FROM table_name;

Example:

SELECT * FROM students;

This will fetch the whole table as below: