Mysql in and mysqlin

Source: Internet
Author: User

Mysql in and mysqlin

The following describes the usage of MySQL in:

They are followed by a table (record set) after the in keyword and a string set after the in keyword.

Let's start with a table.


First, describe the structure of the three tables:

S (sno, sname. sex, age, dept) // student information table

C (cno, cname, tname) // course information table

SC (sno, cno, grade) // optional course information table

Update SC set grade = 0 where SC. cno in (select cno from c where c. cname = 'physical ') and SC. grade <60; for example, this SQL statement sets the physical fail score to 0.

In this example, the in is followed by a temporary table generated by the select statement.


Well, now let's take a look at the following in followed by a string set, which is not necessarily a string set.

Select * from s where sname in ('aaa', 'bbb ', 'ccc ');




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.