Temp table:
* * This is a table and data * *
SELECT * FROM score where num > 60;
* * Turn the table data into a temporary table, as a temporary table, then you can query the data in this temporary table * *
(SELECT * FROM score where num >60) as B;
The contents of this () are the data of a temporary table, and B after as is the name of the temporary table.
* * Re-fetching data in temporary tables * *
Select Sid from (SELECT * from score where num>60) as B;
Problem:
There is no limit to getting data in a temporary table.
For:
Yes, only the fields of the temporary table can be evaluated two times. For example, there is a field sid,student_id,corse_id,number in the table score, so the SID field is removed in the temporary table, and if there is no SID in the score, it is not fetched.
Select number from (select Corse_id,number from score where num>60) as B;
MySQL-----Temp Table