Category: SQL Tutorials

A select statement is used to select information from one or more tables. SQL statements can be on one or more lines. SQL is not case sensitive. SELECT is the same as select. SQL SELECT Syntax

 

SELECT column_name(s)
FROM table_name

OR SELECT * FROM table_name

 

If all columns of a table should be selected, the asterisk symbol * can be used to denote all attributes. The query retrieves all tuples with all columns from the table EMP. To illustrate the usage of the SELECT command we are going to use the EMP table:

 

If the User is interested to finds the specified columns from a table are specified by keyword Select. SELECT identifies what columns. This operation is also called projection. The SQL statement below shows a simple usage of the SQL SELECT command with columns:

 

SELECT ENAME, SAL, EMPNO FROM EMP;

 

ENAME SAL EMPNO
SMITH 800 7369
ADAMS 1100 7876
JAMES 950 7900
MILLER 1300 7934
ALLEN 1600 7499
WARD 1250 7521
MARTIN 1250 7654
TURNER 1500 7844
JONES 2975 7566
BLAKE 2850 7698
CLERK 2450 7782
SCOTT 3000 7788
FORD 3000 7902
KING 5000 7839

 

The SQL query starts with the SELECT keyword followed by a number of columns. This number of Columns specifies which columns you want to retrieve from your table. The list of columns is followed by the SQL keyword FROM and the table name (the table we are selecting data from).

 

Instead of an attribute name, the select clause may also contain arithmetic expressions involving arithmetic operators etc. For Example

 

SELECT 2+2 FROM DUAL;



Dinesh ThakurDinesh Thakur is a Columinist and designer with strong passion and founder of Computer Notes. if you have any ideas or any request please get @me on
linkedin FaceBook Twitter Google Plus