SQL Help (Beginner)

Hey everyone, I am having trouble with something that seems quite simple. I am a complete beginner so I’m sure it’s something very obvious. I am trying to write a query that will search student id’s who have completed course 1 and 2. The table I am working with and the results I keep getting from searches I have tried are below. I think the problem lies with how the student id’s are listed more than once, so I am having trouble finding a way to just get 1.1 and 1.4 listed as only those have completed 1 and 2.

Any help would be appreciated, thanks!

CREATE TABLE StudentPayment

(Student_id VARCHAR (15),

Course_id VARCHAR (15),

PRIMARY KEY (Student_id, Course_id),

FOREIGN KEY (Student_id) REFERENCES Students (Student_id),

FOREIGN KEY (Course_id) REFERENCES Courses (Course_id),


————— —————

1.1 1

1.1 2

1.2 2

1.3 2

1.4 1

1.4 2

1.6 2

submitted by /u/Corey0595
[link] [comments]

Go to Source of this post
Author Of this post: /u/Corey0595
Title Of post: SQL Help (Beginner)
Author Link: {authorlink}