I recently bought several sql2005 books. I can see some of the classic problems in the books, so that I can easily find them later.
This book is <SQL Server 2005 advancedProgramDesign> America: translated by Robert Vieira and Dong Ming. A very basic book.
Differences between inner join, left join, and right jion
Table A Table B is connected to userid.
Inner join: A. userid = B. userid to obtain records that meet the conditions that both tables have the same userid
Left join:. userid = B. userid obtains the record that satisfies the userid in Table A, that is, the record of userid in Table A on the left of the equal sign. The content not found in Table B is replaced by null.
Right join:. userid = B. userid obtains the record that satisfies the userid in Table B, that is, the record of userid in Table B on the right of the equal sign. The content not found in Table A is replaced by null.
All any some differences
ALL: All records must be satisfied.
Some, any: can satisfy any one
Table A has three userid records, which are 3 9 13
taking 5 as the condition as an example:
select * From DBO. A Where 5> All (select ID from a) because there are 3 in userid, so one does not meet the requirements of more than 5, the result is false
select * From DBO. A Where 5> Any (select ID from a) Because userid contains 9 13, so there is a value greater than 5, so the result is true