oracle

Sunday, 16 April 2017

SQL:Select statement

Select statement is used to retrieve or extract data from the database table.
Here we can discuss,

All data retrieve from the table:

Syntax:

Select * from table_name;

In the above query, Select and from are the keywords , table_name is the name of which table from where data is retrieved(extract) and * is used for select all data , mean data from all the columns of the table,
this query will retrieve all data from the emp table.


Example:

Select * from emp;

emp is table of employees in the scott schema of oracle database.

Data From One column :

Syntax:

Select column_name from table_name;

Column name is the name of column and table name is the name of table from where data is retrieved.

Example:

Select ename from emp;

this query will show the name of all employees in the emp table;

Data From multiple columns:

we can retrieve data from two or more columns seperated by comma.

Syntax:

select col_1, col_2, .........,coln ffrom table_name;

you can add columns name seperated by comma.

Example:

Select ename, job , sal from emp;

This Query will retrieve data from ename, job and salary column of employee table.
.

No comments:

Post a Comment