join| Cross join| INNER join via on join condition (all three ways) is usually connected with join, on the back of the connection condition--Query Cms_user id,username the provinces table and the user table have IDs--Query the provinces in the provinces table, PronameSELECTCms_user.id,username,proname fromCms_user,provinces;--This query is not correct, because there are IDs in all two tables, and the result of the query is not the actual desired result, but the form of the Cartesian product .--Cms_user's proid corresponds to the ID in the province tableSELECTCms_user.id,username,proname fromcms_user,provincesWHERECms_user.proid=provinces.id;--Inner Connection (this is the same as the Where in the above (first write the table to query things, then write the conditions)--querying the Id,username,email,sex in the Cms_user table--querying the Proname in the provinces tableSELECTU.id,u.username,u.email,u.sex,p.proname fromCms_user asU--connect the first table INNER JOINProvinces asP--second table of connections onU.proid=P.id;--Specify the connection condition by on, where the condition is that when the user's table is proid, the ID in the province table--the first table to query: query Cms_user id,username,sex--second table to query: query provinces prpname--the join condition after on is: The proid of the user table equals the ID of the province table. --condition: cms_user sex for the male userSELECTU.id,u.username,u.sex,p.proname fromCms_user asuJOINProvinces asP onU.proid=p.idWHEREU.sex='male';--Filter the grouped results, according to Proname group, select the number of people greater than or equal to 1, and according to the ID of the user table in ascending order, limit the number of bars displayed (the first two)SELECTU.id,u.username,u.sex,p.proname,COUNT(*) astotalsum,group_concat (Sex) fromCms_user asuJOINProvinces asP--Connection onU.proid=p.idWHEREU.sex='male'GROUP byP.proname having COUNT(*)>=1ORDER byU.idASCLIMIT0,2;;--querying the Id,title in Cms_news--querying the Catename in Cms_cate--connection Condition: n.cid=c.idSELECTN.id,n.title,c.catename--write the query first, fromCms_news asN--write a few more tables to connect toJOINCms_cate asC onN.cid=C.id;--Write Connection Conditions--cms_news Id,title--cms_cate Catename--cams_admin username, role--connection conditions: Conditions for Cms--news and cms--cate: n.cid=c.id cms_news and Cams_admin connection conditions:SELECTN.id,n.title,c.catename,a.username,a.role fromCms_news asN--Three-table connection Cms_news and cms_cate,,,cms_admin respectively established connectionJOINCms_cate asC onN.cid=c.idJOINCms_admin asa onN.aid=a.ID;