Selection : It displays all the rows in a table it can also be used to select only the specific data according to the user criteria
Syntax : select * from <table name>;
(OR)
select <col name> from <table name>;
Example:
SQL> select * from std;
SNO SNAME CITY CID
---------- ----------- ---------- ----------
111 raju vsp 11
222 rani hyd 11
333 vani vzm 22
444 kani rjm 33
555 poni anp 33
SQL> select * from std where sno=333;
SNO SNAME CITY CID
---------- ----------- ---------- ----------
333 vani vzm 22
SNO SNAME CITY CID
---------- ----------- ---------- ----------
111 raju vsp 11
222 rani hyd 11
333 vani vzm 22
444 kani rjm 33
555 poni anp 33
SQL> select * from std where sno=333;
SNO SNAME CITY CID
---------- ----------- ---------- ----------
333 vani vzm 22
Projection: It displays all values for certain attributes specified after the command . It shows a vertical view of the give table .
Example:
SQL> select sno,city from std;
SNO CITY
---------- ----------
111 vsp
222 hyd
333 vzm
444 rjm
555 anp
SNO CITY
---------- ----------
111 vsp
222 hyd
333 vzm
444 rjm
555 anp
No comments:
Post a Comment