SQL Server Management Studio: The columns in table do not match an existing primary key or unique constraint I have two tables:  Students and Courses.  I want to set a foreign key in the Students table from the couseId column to the courseId column in the Courses table.  I have set primary keys to both courseId columns but Management Studio is still giving me the error The columns in table 'Courses' do not match an existing primary key or unique constraint.'  What am I doing wrong?
I think you want a junction table. I have no idea what the point-and-click UI is doing behind the scenes or how you are getting into this situation but I think this makes more sense:

CREATE TABLE dbo.Students
(
  StudentID INT PRIMARY KEY,
  ... Other columns ...
);

CREATE TABLE dbo.Courses
(
  CourseID INT PRIMARY KEY,
  ... Other columns ...
);

CREATE TABLE dbo.StudentCourses
(
  StudentID INT NOT NULL FOREIGN KEY
      REFERENCES dbo.Students(StudentID),
  CourseID INT NOT NULL FOREIGN KEY
      REFERENCES dbo.Courses(CourseID),
  PRIMARY KEY(StudentID, CourseID)
);


Now, I am not entirely clear why one of your images shows SemesterID as part of the key for one of the tables; I don't know enough about the business logic and how you define courses to guess where that should be. But for the student-course relationship, again unless I have a completely bizarre definition of "course," should not be declared in the Students table.

Also, I wouldn't use the CHAR data type for strings that will clearly have different lengths. You should use varchar (or maybe nvarchar, depending on location and your school's educational domain) for course name, and nvarchar for proper names.