Friday, 1 March 2013
SQL: AND Command
Do you like this Article?
In SQL, we have, seen that, we can add conditions by using WHERE command, during any SELECT, UPDATE or DELETE operation. Now, what about multiple conditions? For that, SQL provides to add multiple condition by using AND command. it can be used as many times as you want.
Syntax: SELECT [column_name] FROM [table_name] WHERE [condition_1] AND [condition_2];
[Note: AND means mandatory condition, that means, the operation has to always fulfill the criteria provied under AND block. ]
Example:
Again, use the same table, we will see the usage of AND command.
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, using AND command, we will SELECT those tuple, WHERE emp_role is 'Developer' and emp_address is 'Park Street, Kolkata'.
So, the query will be :
SELECT * FROM employee_details WHERE emp_role = 'Developer' AND emp_address = 'Park Street, Kolkata';
Result:
In this way, we can use multiple conditions on an RDBMS operation.
Syntax: SELECT [column_name] FROM [table_name] WHERE [condition_1] AND [condition_2];
[Note: AND means mandatory condition, that means, the operation has to always fulfill the criteria provied under AND block. ]
Example:
Again, use the same table, we will see the usage of AND command.
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, using AND command, we will SELECT those tuple, WHERE emp_role is 'Developer' and emp_address is 'Park Street, Kolkata'.
So, the query will be :
SELECT * FROM employee_details WHERE emp_role = 'Developer' AND emp_address = 'Park Street, Kolkata';
Result:
In this way, we can use multiple conditions on an RDBMS operation.
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...
0 Responses to “ SQL: AND Command ”
Post a Comment