Back to Top

Sunday, 17 February 2013


SELECT command is use in SQL to "SELECT [some info] FROM [a location]".  Now, this is the basic structure of the SELECT query, where SELECT and FROM are 2 commands of SQL. Here, [some info] part will be the column names separated by comma (,) sign and [a location] part will be the name of the Table or View. So, the syntax will be :

For Single Column :
Syntax : SELECT [Column_name] FROM [Table_Name];

For Multiple Columns :
Syntax : SELECT [Column1_name, Column2_name, Column3_name] FROM [Table_Name];

Now, what if you want to select all the columns of a table or a view. Do you have to write all the column name for that. No necessarily, you can user the star (*) sign in [Column_name] area. Then the syntax will be:

For All Columns :
Syntax : SELECT * FROM [Table_Name];

Suppose there is a table to keep
Employee Details (Table Name: employee_details), which contains
Employee ID(Column Name: emp_id), 

Employee Name(Column Name: emp_name), 
Employee Address:(Column Name: emp_address) and
Employee Role: (Column Name: emp_role).

Table:  employee_details 

 Now, to select emp_id and emp_name from the table, the query will be,

SELECT emp_id, emp_name FROM employee_details;


 Again, if you wants to select all the colunms' record, then the query will be,

 SELECT * FROM employee_details;



2 Responses to “ SQL: SELECT Command ”

Power Cords said...
21 February 2013 at 13:56

Good to see the SQL learning in this blog. SQL is easy command base language but difficult to learn for so many people specially for new web programmers.

Naviya Nair said...
24 October 2016 at 15:14

I have read your blog its very attractive and impressive. I like it your blog.

Java Training in Chennai Java Training in Chennai | Core Java Training in Chennai

Online Java Training Java 8 Online Training | Java J2EE Online Training | JavaEE Training Institute in Chennai Java Training Institutes

Java Training Institutes in Chennai Java Training in Chennai

Post a Comment

Popular Posts

All Rights Reserved JAVA INTERVIEW QUESTIONS | Privacy Policy | Anijit Sarkar
blog links Web Directory Academics Blogs