Two usage methods of 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 ');