Select Query

The select query is used to display the contents of the table. It can either be used to display the entire table, specific columns, columns with some particular values or specific cases.

The different ways in which select can be used are as follows:

1 . Select *

It is used to select all the rows and columns from the tables. One can also use keyword ‘ALL’ to select all the rows and columns from the given table.

 select * from students;

The output of the query is as follows:

2 . Select DISTINCT

It is used select only the distinct values in a particular column. Inside a table, a column often contains many duplicate values; and sometimes you only want to list the different (distinct) values.

select distinct Class from students;

OUTPUT :

3 . Selecting Columns using their names

select Name , Subject
    -> from students;

The output of the same is given below.

2 thoughts on “Select Query

Add yours

Leave a comment

Create a website or blog at WordPress.com

Up ↑

Design a site like this with WordPress.com
Get started