Saturday, 23 February 2013
SQL: WHERE Command
Do you like this Article?
In SQL,when ever you want to SELECT some data, or UPDATE or DELETE some information from a Table, you needs to provide some condition, on basis of which operation will be performed. It's not necessary to SELECT, UPDATE or DELETE all data from a table or view. So, condition is necessary to filter the data when performing an operation on database. The basic structure of of WHERE conditions is :
Syntax: SELECT [column_name] FROM [table_name] WHERE [condition]
Example:
Again, we will see the same table
Employee Details ( employee_details), which contains
Employee ID ( emp_id),
Employee Name (emp_name),
Employee Address (emp_address) and
Employee Role: (emp_role).
Table: employee_details
Now, from this table, if a situation ariser, where we have to just select the information of the developers, the we have to set some condition on our SELECT query, so that we can get the details of the employees with 'emp_role' 'Developer' . Then the Query will be
SELECT * FROM employee_details WHERE emp_role = 'Developer';
Result:
In this way we can filter our data output.
Syntax: SELECT [column_name] FROM [table_name] WHERE [condition]
Example:
Again, we will see the same table
Employee Details ( employee_details), which contains
Employee ID ( emp_id),
Employee Name (emp_name),
Employee Address (emp_address) and
Employee Role: (emp_role).
Table: employee_details
Now, from this table, if a situation ariser, where we have to just select the information of the developers, the we have to set some condition on our SELECT query, so that we can get the details of the employees with 'emp_role' 'Developer' . Then the Query will be
SELECT * FROM employee_details WHERE emp_role = 'Developer';
Result:
In this way we can filter our data output.
Subscribe to:
Post Comments
(
Atom
)
Popular Posts
-
public - public means everyone can access it.That means it's in global scope. As, main method is called by JVM [ Java Virtual Machine...
-
throw is used to throw an exception in a program, explicitly . Whereas, throws is included in the method's declaration part, wi...
-
Singleton in one of the most popular yet controversial design pattern, in the world of object oriented programming. It's one of t...
-
Web Container / Servlet Container / Servlet Engine : In J2EE Architecture , a web container (also known as servlet container or ser...
-
Program compiles. But at runtime throws an error “NoSuchMethodError”.
-
Vector : It's synchronized. It's slower than ArrayList. It's generally used in ...
-
doGet(): protected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, java.io.IOException – is a met...
-
In Java Programming Language , we must declare a variable name and type, before using it. The data type of a variable defines the th...
1 Responses to “ SQL: WHERE Command ”
21 June 2018 at 16:30
Best M Tech Colleges in Noida
Best M Tech Colleges in Delhi
Best M Tech Colleges in Gurgaon
Best M Tech Colleges in UP
Best M Tech Colleges in India
Best M Tech Colleges in Hyderabad
Best M Tech Colleges in Bangalore
Best M Tech Colleges in Chennai
Post a Comment