1

I am learning MySQL and I am trying to make simple arithmetic in the query, I am trying to write a command that would determine the number of Instructors in each Faculty in the university Can anyone help me in this? Thank you!

Here below are my two tables:

    ________________________________________________________
    |    Department       |    Faculty         |  Building  |      
    --------------------------------------------------------        
    |    Humanities       |  Arts and Sciences |  Chardon   |
    |     English         |  Arts and Sciences |  Chardon   |
    |   Mathematics       |  Arts and Sciences |  Monzon    |
    | General Engineering |    Engineering     |  Stefani   |
    |     Agronomy        |    Agriculture     |  Pinero    |

     _________________________________________________________________________
    |  Professor  |      Department        |      Rank           |  Salary    |
    ---------------------------------------------------------------------------
    |  Joe Blow   |         Biology        |     Professor       | $73,500.00 |
    |  Sam Snow   |       Mathematics      |     Instructor      | $45,700.00 |   
    | George Grow | Electrical Engineering | Associate Professor | $69,250.00 |
    | Hiram Lowe  |         English        | Assistant Professor | $63,750.00 |

1 Answer 1

1

Something close to this:

select department.faculty, count(professor.professor) as instructors from department join professor on department.department = professor.department group by department.faculty

Basically you do a join to "merge" the two tables, then group results by faculty, and count professors for each faculty.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.