Site icon Narayana Tutorial

SQL SELECT


In this tutorial post, we are going to discussing SQL SELECT statement in oracle data base.

Consider we have EMPLOYEE demo table which is using for the executing SELECT command.

EMP_ID EMP_NAME EMP_DESIGNATION EMP_GENDER EMP_QUALIFICATION EMP_LOCATION
100 Narayanaswamy Sr.Software Engineer Male MCA Chennai
101 Kumar Quality Analyst Male B.Tech Chennai
102 Ramesh Database Administration Male B.Tech Chennai

SQL Select Statement

The SELECT statement is used to select / retrieve data from a database.

Selected / retrieved data we can say result-set or result table.

Show all details

Show all details i.e. all columns and all rows from employee table

Syntax:

SELECT * FROM <Table-Name>;

Query:

SELECT * FROM EMPLOYEE;

It will return all columns result set data from the table as below.

EMP_ID EMP_NAME EMP_DESIGNATION EMP_GENDER EMP_QUALIFICATION EMP_LOCATION
100 Narayanaswamy Sr.Software Engineer Male MCA Chennai
101 Kumar Quality Analyst Male B.Tech Chennai
102 Ramesh Database Administration Male B.Tech Chennai

 

Filtering Table Data

The ways of filtering table data are:

  1. Selected columns and all rows.
  2. Selected rows and all columns.
  3. Selected columns and selected rows.

Selected columns and all rows

Syntax

SELECT <Column-Name 1>,<Column-Name 2> FROM <Table-Name>;

Query

SELECT EMP_ID,EMP_NAME FROM EMPLOYEE;

It will return EMP_ID and EMP_NAME result set data from the table.

EMP_ID EMP_NAME
100 Narayanaswamy
101 Kumar
102 Ramesh