Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 problem

Author  Topic 

dilip_cs08
Starting Member

1 Post

Posted - 2011-03-31 : 11:50:40
can i split a composite primary key. I have a relational table department_wise_offered_course.
The fields are
dept_code,course_code,term_yr,term_type,add_on_credit.
course_code is the primary key of "course" table,dept_code is the primary key of "department" table, (term_yr,term_type) is the primary key of "term" table. I have no complete idea if the primary key from different table must be a primary key in the relational table.
Is the (dept_code,course_code,term_yr,term_type) be the composite primary key in "department_wise_offered_course" table, but if this,problem is that if someone wants to find the courses offered by a particular department, then how i display it. It will be a great help to me if someone reply to me.

with regards

Dilip.

sonowal

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-04-01 : 07:26:01
If you have the table department_wise_offered_course as you have described it, you can find the courses offered by particular department by a select query such as this:

select course_code
from department_wise_offered_course
where dept_cod = 'Engineering' -- or whatever the department code is
Go to Top of Page
   

- Advertisement -