Fortune Telling Collection - Free divination - How to write complex SQL technical questions and answers

How to write complex SQL technical questions and answers

Suppose: table_user: user table (id, usename) table _ planet: planet table (userid, people)[php]// sub-query mode, which is not recommended and inefficient, choose name, (select sum (people) from table _ planet where userid = table _ user.id) as the joint query mode of headcount from table _ user//, and select t 1.username, sum (t2.people) as the headcount recommendation? Internal connection table _ user as t1ont2.userid = t1.id from table _ planet as t2 group by t2.userid [/PHP].