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 8134715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:07:57+00:00 2026-06-06T10:07:57+00:00

these are my tables: TABLE ‘USERS’ ID NAME AGE 01 John 22 02 Gloria

  • 0

these are my tables:

TABLE ‘USERS’

ID      NAME     AGE 
01      John     22
02      Gloria   27

TABLE ‘CITIES’

ID    USER_ID    CITY
22    01         Sacramento
23    02         Phoenix

TABLE ‘HOBBIES’

ID     USER_ID   HOBBY
88     01        swimming
89     01        reading
90     02        reading

Okay, so we have two fellas: John is from Sacramento and likes swimming and reading.
Gloria is from Phoenix and only likes reading.

I know how to join the first two tables:

SELECT * FROM users INNER JOIN cities ON users.id = cities.user_id

But how can I join the ‘hobbies’ table and only display users who like swimming?

Thanks a lot,
Matthias

  • 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-06T10:07:58+00:00Added an answer on June 6, 2026 at 10:07 am

    You will just add a JOIN to the last table and add a WHERE clause

    SELECT * 
    FROM users  
    INNER JOIN cities  
        ON users.id = cities.user_id
    INNER JOIN hobbies
        ON users.id = hobbies.USER_ID
    WHERE Hobbies.Hobby = 'swimming'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In PostgreSQL for these tables CREATE TABLE cities ( name text, population float, altitude
Suppose you have these tables: Table Name: Salesman Fields: S_ID(Primary Key), Name Table Name:
I have these tables Table 1 tbl1_site [facilityId] [name] Table 2 tbl2_applicant [pvid] [facilityId]
I have these tables CREATE TABLE parent ( id NUMBER(10, 0) NOT NULL, name
I have these two tables: Table: ORDERS ID - NAME - DATA --------------------------------------------- 1
Here is my table and data of these tables Table name: Code CID Code
I have these tables: CREATE TABLE User( Username varchar(15) NOT NULL, Name varchar(20) DEFAULT
I actually have these tables : - Table games - ID Name - Table
Suppose I have these tables create table bug ( id int primary key, name
I have these tables: USER TABLE uid | name | role | | 1

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.