Questions about database foreign key and primary key query

Source: Internet
Author: User
It is not long before you learn about the database foreign key and primary key query. Ask the Experts: Table A has the ID and name, and Table B has the ID and score, the ID of Table B is the foreign key of Table A. How can we get the score by finding the name of Table !, SelectB. fenshufromAjoinBONA. id = B. idwhereA. name = 'Zhang San'; database foreign key and primary key query problems
It wasn't long before I learned about the database:
Table A has the ID and name, Table B has the ID and score, and Table B's ID is the foreign key of Table A. How can we get the score by finding the name of Table!

------ Solution --------------------
Select B. fenshu from A join B on a. id = B. id where A. name = 'Zhang San ';

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.