Skip to content
Advertisement

How to retrieve students data based on teachers ID

According to a simple scenario ER diagram as follows.

enter image description here

Based on that, I developed a database mapping as follows.

enter image description here

In there, orange color columns shows the primary key of the tables and yellow color columns shows foreign key of the tables. Is this mapping correct? Now my problem is I need to retrieve students data who learned from some teacher, which means need to retrieve some teacher’s sudents who learned from his/her.

Advertisement

Answer

You need to learn about how to join tables using different types of available JOINs.

For your scenario , try like following, it will give you Student and the Teacher mapping.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement