Narayana Tutorial

Online Java Tutorial Blog

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
Narayanaswamy

Hello! I am Narayanaswamy founder and admin of narayanatutorial.com. I have been working in IT industry more than 7 years. NarayanaTutorial is my web technologies blog. My specialties are Java / J2EE, Spring, Hibernate, Struts, Webservices, PHP, Oracle, MySQL, SQLServer, Web Hosting and Website Development.

I am a self learner and passionate about training and writing. I am always trying my best to share my knowledge through my blog.

Leave a Reply

Narayana Tutorial © 2018 Frontier Theme
Show Button
Hide Button