Home  >  Article  >  Backend Development  >  关于数据库外键和主键查询的有关问题

关于数据库外键和主键查询的有关问题

WBOY
WBOYOriginal
2016-06-13 10:14:20643browse

关于数据库外键和主键查询的问题
刚学数据库没多久,请教各位大神:
A表有ID和姓名,B表有ID和分数,B表的ID是A表的外键,如何通过查找A表的姓名就能得到分数!

------解决方案--------------------
select B.fenshu from A join B ON A.id=B.id where A.name='张三';

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn