sql server - Relationship between databse tables -


i have existing db schema this.is there way create kind of referential integrity between these 2 tables. kind of relationship ? many many 2 classes

student table:

id    name     courseid ------------------------  1    student1     100023  2    student2     100023  3    student3     100024    4    student4     null   

course table:

id   courseid   coursename --------------------------  1   100023      course1    2   100022      course2    3   100024      course3    4   100023      course6   

id primary key in both tables. courseid column relationships.

definitely. can create foreign key constraint between student.courseid , course.courseid. can either through sql server management studio directly or using alter table/add constraint statement. personally, find management studio easiest use.

do search on "sql foreign key constraints" , should find w3schools (or similar) explaining need know started them.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -