Difference between In and where In SQL and between sqlinwhere

Source: Internet
Author: User

Difference between In and where In SQL and between sqlinwhere

The meaning of In and Where In SQL statements is different.
The application is explained as follows:

1. If you need to select, delete, and update data from a table with conditions, use Where;
2. In is only used as an operator under the Where Condition Clause. Besides In, there are also Between, Like, =,>,> =, <, <=, and other operators.
The following is an example:
1. If you query A and B students, the statement is
Select * from student where name in ('A', 'B ');
........................................ ........................................ .......................................
The where clause is followed by a conditional expression, indicating that the result meeting this condition is to be found.
In is a subquery or a given value.
For example, select * from student where Sname = 'zhang san';/* query the information of a student named Zhang San */

Select * from student where Sname in ('zhang san', 'Li si');/* query the student information of Zhang Sanhe and Li Si */

Select * from student where Sname in (select Sname from sn where Sno = '001');/* query the student information whose student ID is 001 */

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.