Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7989791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:50:42+00:00 2026-06-04T12:50:42+00:00

I need to create a view called phonelist which list each player, their guardians,

  • 0

I need to create a view called phonelist which list each player, their guardians, the guardians phone number and the team they play in. How would I code this. All the information you need you should find below:

enter image description here

These are my tables:

CREATE TABLE Person
(
personID INT NOT NULL,
name VARCHAR(50),
address VARCHAR(70),
phone VARCHAR(15),
email VARCHAR(30),
year INT,
PRIMARY KEY (personID)
);

CREATE TABLE Player
(
personID INT NOT NULL,
dateOfBirth DATE,
school VARCHAR(30),
PRIMARY KEY (personID),
FOREIGN KEY (personID) REFERENCES Person (personID)
);

CREATE TABLE Team
(
teamID INT NOT NULL,
tName VARCHAR(70),
ageRange VARCHAR(30),
PRIMARY KEY (teamID)
);

CREATE TABLE Coach
(
personID INT NOT NULL,
dateBeganCoaching DATE,
PRIMARY KEY (personID),
FOREIGN KEY (personID) REFERENCES Person (personID)
);

CREATE TABLE coachTeam
(
personID INT NOT NULL, 
teamID INT NOT NULL,
PRIMARY KEY (personID, teamID),
FOREIGN KEY (personID) REFERENCES Coach (personID),
FOREIGN KEY (teamID) REFERENCES Team (teamID)
);

CREATE TABLE playerTeam
(
personID INT NOT NULL, 
teamID INT NOT NULL,
PRIMARY KEY (personID, teamID),
FOREIGN KEY (personID) REFERENCES Player (personID),
FOREIGN KEY (teamID) REFERENCES Team (teamID)
);

CREATE TABLE Guardian
(
parentID INT NOT NULL,
childID INT NOT NULL,
PRIMARY KEY (parentID, childID),
FOREIGN KEY (parentID) REFERENCES Person (personID),
FOREIGN KEY (childID) REFERENCES Person (personID)
);

CREATE TABLE Qualification
(
qualificationID INT NOT NULL,
qName VARCHAR(30),
PRIMARY KEY (qualificationID)
);

CREATE TABLE coachQualification
(
qualificationID INT NOT NULL,
personID INT NOT NULL,
PRIMARY KEY (personID, qualificationID),
FOREIGN KEY (qualificationID) REFERENCES Qualification (qualificationID),
FOREIGN KEY (personID) REFERENCES Coach (personID)
);

How would I do it so that I am using only the person table to reference the player, and guardians and how would I do it so that if a player had more than one guardian both guardian would be placed on the same line as opposed to creating an entire new row in the output to dispaly both guardian thanks.

I have tried the following but have gotten errors:

CREATE VIEW phonelist AS 
SELECT Child.name, tName, Parent.name, Parent.phone
FROM playerTeam INNER JOIN Person AS Child ON playerTeam.personID = Child.personID
                INNER JOIN Team ON playerTeam.teamID = Team.teamID
                INNER JOIN Person AS Parent ON Guardian.parentID = Parent.personID;

Select * FROM phonelist ORDER BY name ASC;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:50:43+00:00Added an answer on June 4, 2026 at 12:50 pm
    Select P.ID, P.Name, P2.PersonID, P2.Name, P2.Phone, T2.tName as GuardianTeam T.tName as PersonTeam
    INNER JOIN Player PL on PL.PErsonID=P.PersonID
    INNER JOIN Guardian G on G.ParentID = P.PersonID
    LEFT JOIN Person P2 on P2.PersonID = G.ChildID
    INNER JOIN PlayerTeam PT on PT.PersonID = PL.PersonID
    LEFT JOIN Player PL2 on PL2.PersonID = P2.PersonID
    LEFT JOIN PlayerTeam PT2 on PT2.PersonID = PT2.PersonID
    LEFT JOIN Team T2 on T2.TeamID = PT.TeamID
    INNER JOIN Team T on T.TeamID = PT.TeamID
    

    Ah ok edit to remove person team…

    Returns all persons who are players, their guardian name, phone and guardian team as well as any players without guardians; or instances where guardians are not part of teams, or players themselves.

    Select P.ID, P.Name, P2.PersonID, P2.Name, P2.Phone, T2.tName as GuardianTeam
    INNER JOIN Player PL on PL.PErsonID=P.PersonID
    INNER JOIN Guardian G on G.ParentID = P.PersonID
    LEFT JOIN Person P2 on P2.PersonID = G.ChildID
    LEFT JOIN Player PL2 on PL2.PersonID = P2.PersonID
    LEFT JOIN PlayerTeam PT2 on PT2.PersonID = PT2.PersonID
    LEFT JOIN Team T2 on T2.TeamID = PT.TeamID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a view like below. Not sure what this view called.
I need to create a view with a column that indicates which table does
In my app, I create view controller objects as I need them. When a
I understand that we need to create MXML file to define a view. Suppose
UPDATED: I am using MySQL statement to create a view: I need to show
i need create an email list sending to many emails. what is best solution
So I took some advice to create a DropDownListFor element in my view, which
I'm creating an application in hibernate where i need to create a dropdown list
I need to create a list in c# with click-able and customizable child elements.
We have a custom object in Salesforce called domain which reflects each website we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.