Study Notes (1)

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.