In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
SQL Server how to achieve multi-table join query function, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
The specific code is as follows:
-- Cross-connection produces Cartesian value (X-ray) SELECT * FROM Student cross Join dbo.ClassInfo-- another way to write SELECT * FROM Student, ClassInfo-- Internal connection (Inner can be omitted) SELECT * FROM Student JOIN dbo.ClassInfo ON dbo.Student.Class = dbo.ClassInfo.ID;-- Inner JoinSELECT * FROM Student INNER JOIN dbo.ClassInfo ON dbo.Student.Class = dbo.ClassInfo.ID -- on condition, usually primary foreign key, but not limited to primary foreign key-- on condition, which allows multiple And it may be SELECT * FROM Student INNER JOIN dbo.ClassInfo ON dbo.Student.Class = dbo.ClassInfo.ID AND dbo.Student.Class IN for a table-- adding query conditions to the Student table-- is not equal to (Cartesian values minus equivalent values) SELECT * FROM Student INNER JOIN dbo.ClassInfo ON dbo.Student.Class dbo.ClassInfo.ID -- self-join queries from the Class table to find the Class system SELECT T1.*, T2.ClassName FROM dbo.ClassInfo AS T1 INNER JOIN dbo.ClassInfo AS T2 ON T1.PIDstores T2.IDSumi-Left JoinSELECT * FROM Student Left JOIN dbo.ClassInfo ON dbo.Student.Class = dbo.ClassInfo.ID;-- Right JoinSELECT * FROM Student RIGHT JOIN dbo.ClassInfo ON dbo.Student.Class = dbo.ClassInfo.ID;-- full external connection SELECT * FROM Student FULL OUTER JOIN dbo.ClassInfo ON dbo.Student.Class = dbo.ClassInfo.ID -- the difference between an outer connection and an inner connection is:-- Inner connection. If the on condition is not met, the data will be filtered-- the outer connection will mainly retain the table, and the on condition will set up to display the data. Otherwise, display NULL--Union longitudinally connect SELECT StuID,StuName,StuEnName,StuAge,StuBirthdayFROM Student WHERE StuID2--Union to repeat SELECT StuSexFROM Student WHERE StuID2--Union to show all SELECT StuSexFROM Student WHERE StuID2--Except subtractions, excluding SELECT StuID,StuName,StuEnName,StuAge,StuBirthdayFROM StudentExceptSELECT StuID,StuName,StuEnName,StuAge,StuBirthdayFROM dbo.Student WHERE StuID=2ExceptSELECT StuID,StuName,StuEnName,StuAge,StuBirthdayFROM dbo.Student WHERE StuID
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.