Select sql query

Select sql query

Blog Bustle 08/02/2020

What is select sql query?

select query is used to fetch records from table.We can fetch records from multiple table by using single query.

Select sql query syntax

select * from table_name;

select column_1,column_2,.... from table_name;

select * from table_name where condition;

select column_1,column_2,.... from table_name where condition;

You can specify one or more condition by using where clause and combine more conditions by using 'and/or' operator.

There are two methods to write select sql query:

Method 1: When where condition is not given

in this method we use select sql query from two ways

a. when we want to fetch all data from table

we have student table.

select sql query

We want to fetch all rows from student table then query will be

select * from student

b. when we want only some column data from table

We want to fetch some column data from student table then query will be

select name,email from student

select sql query

Method 2: When where condition is given

in this method we use select sql query from two ways

a. when we want to fetch all data according to where condition from table

We want to fetch all rows according to where condition from student table then query will be

select * from student where name = 'mihir'

select sql query

b. when we want to fetch only some column data according to where condition from table

We want to fetch some column data according to where condition from student table then query will be

select name,email,mobile from student where name = 'mihir'

select sql query

Other important links

Insert query in mysql

Update query in mysql

Delete query in mysql

Difference between sql and mysql

Create Database in mysql

Select sql query searches:

Tags: #mysql