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

  • Home
  • SEARCH
  • 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 8498205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:20:21+00:00 2026-06-11T00:20:21+00:00

There are two tables, students and courses . The students table has name ,

  • 0

There are two tables, students and courses. The students table has name, age and ssn.

Courses has ssn and Course.

Now the ssn in the courses table is NOT unique but the one in students is primary key.

I need to find out the students who are taking any of the classes that student C is taking (including C‘s name as well in the resulting solution).

It’s a challenge problem so I can just not mind it but I want to find out what the solution is.

So far I’ve tried to use a union operator like this :

SELECT ssn
FROM courses
UNION SELECT ssn
FROM students
WHERE name =  'c'

All this does is it returns all the ssns from the table courses. The question asks us to effectively find the set UNION of the both tables to determine the solution.

Any help is appreciated!

  • 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-11T00:20:22+00:00Added an answer on June 11, 2026 at 12:20 am
    SELECT DISTINCT s2.ssn, s2.name
        FROM students s1
            INNER JOIN courses c1  /* Find all courses taken by student 'c' */
                ON s1.ssn = c1.ssn
            INNER JOIN courses c2  /* Find all students in all of c's courses */
                ON c1.course = c2.course
            INNER JOIN students s2 /* Get the details for each of those students */
                ON c2.ssn = s2.ssn
        WHERE s1.name = 'c'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are two tables: CREATE TABLE STORE ( ID INTEGER NOT NULL, MEDICINE_ID INTEGER
I have next input data, There are two tables create table Courses( id number(19)
There are two tables Table 1 select * from manage_tcp; +----+----------+--------+ | id |
There are two tables Table A id column_a 01 abc 01 abc 02 abc
I have these two class(table) @Entity @Table(name = course) public class Course { @Id
There are two tables, one is an Answer table and the other is a
I am developing a student registration form in asp.net. there are two tables viz
there are two tables tbldoctor and tblschedule tbldoctor doc_id(PK) docMrId docfname 1 22 manish
There are two tables: A, with rows (row_id, column1, ...) and B, with rows
There are two tables. One is users info users, one is comments info comments.

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.