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

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

WBOY
Release: 2016-06-13 13:39:32
Original
774 people have browsed it

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

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template