A0

Labels

Select Statement and Distinct Keyword

 


Select Statement:

So this is the first blog related to oracle SQL. Today lecture will about the select statement which is one of the important topic in Oracle SQL. It is used to retrieve(show) the data. For example there is employee table in the database and by using select statement we can show the whole data which is present in the table. So here is the query related to select statement.

e.g

select * from emp;

Here * is use as whole. If I will translate this query in simple words  then the meaning of this query will be select or show the whole data from employee table. If I will use this query than output will be this kind.

select * from emp;


In this way we can use the select statement to show the output from database.

Distinct Statement:

Distinct is the keyword which will become statement when we use select with it. We can use distinct keyword only with select statement. Now here question is arising why we use distinct keyword?

Answer for this question is, if there is any duplicate name or value etc in the table then we use this keyword. By using this keyword we can remove the duplicate names or any value from the table. Here I will also provide you the example to use this.

If I will use

select distinct ename from emp;

If I will translate this query in simple words then this query is saying that select the ename values without duplication and the output for this query will be this kind.

select distinct ename from emp;

In this way we can use select statement and distinct keywords. This is enough for today If you need more about oracle sql then visit the SQL section from manu.

0 Comments:

Post a Comment