gpt4 book ai didi

mysql - 在My SQL oracle中连接5个表

转载 作者:行者123 更新时间:2023-11-29 13:59:32 25 4
gpt4 key购买 nike

个人:

IndividualID (PK)
GroupID*
First name
Surname
Gender
DOB
Emergency contact
Home add
Tel

事件组:

ActivityGroupID (PK)
ActivityID*
Individual ID*

事件:

Activity ID* (PK)
SessionID* (PK)
Activity description

session :

SessionID (PK)
Activity ID*
Dates
Type (morning/afternoon) Supervisor ID*

事件主管:

Supervisor ID (PK)
Name
Mobile number
Comments

这是我当前表的复制和粘贴(我将(PK)作为主键,因为下划线没有出现),问题是:

"query that gives full details of all the activities in which an individual member has taken part, including the name of the activity supervisor in each case."

我对 MySQL 还很陌生,非常感谢任何帮助。

最佳答案

You need to learn about JOINS. I will write part of the query. You can complete it with some research from your end.

SELECT 
Activity.Activitydescription,
Sessions.Dates,
Sessions.Type,
Activitysupervisor.Name,
Activitysupervisor.MobileNumber
FROM Activity
INNER JOIN Sessions ON Sessions.SessionID = Activity.SessionID
INNER JOIN Activitysupervisor ON Activitysupervisor.SupervisorID = Sessions.SupervisorID

So basically you need to use JOINS. Learn more about different types of JOINS and complete the query.

关于mysql - 在My SQL oracle中连接5个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15323238/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com