If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Urgent help needed

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-01-08, 16:31
knucklebusster knucklebusster is offline
Registered User
 
Join Date: May 2008
Posts: 5
Urgent help needed

Hi there just start a course in database development and I was given an assignment on computer department in college. We were told to define a schema which I did see the code below.

Code:
CREATE CLASS Department
SUPERCLASS object
RELATIONSHIP set (programme) register inverse programme assigned to

CREATE CLASS Programme
SUPERCLASS: student
RELATIONSHIP set (module) memberOfModule inverse module enrolment
RELATIONSHIP programme leader course leader inverse lecture leads

CREATE CLASS Module
ATTRIBUTE ModuleName: STRING
ATTRIBUTE level: INTEGER
ATTRIBUTE roll: INTEGER
RELATIONSHIP LIST (programme leader) taught by inverse lecture teaches
RELATIONSHIP SET (module) prerequisite

CREATE CLASS student
SUPERCLASS: Object
ATTRIBUTE student: CHARACTER
ATTRIBUTE termAddress: CHARACTER
ATTRIBUTE dateOfBirth: DATE
ATTRIBUTE dataOfEnrolement: DATE

CREATE CLASS Mode of study
ATTRIBUTE studentDetails: student
ATTRIBUTE moduletDetails: student

CREATE CLASS year of study
ATTRIBUTE studentDetails: student
ATTRIBUTE moduletDetails: student

CREATE CLASS moduleAssessment
ATTRIBUTE studentDetails: student
ATTRIBUTE moduletDetails: student

CREATE CLASS programme leader
RELATIONSHIP set (module) teaches inverse module taughtBy
RELATIONSHIP programme leader inverse lecture leads

The problem is that I don’t know were to add the appropriate primary and foreign keys . Your help will be truly appreciated . Thanks in advance .
Reply With Quote
  #2 (permalink)  
Old 05-01-08, 16:42
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
in your own words, what is the purpose of a primary key? what is the purpose of a foreign key?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 05-01-08, 18:02
knucklebusster knucklebusster is offline
Registered User
 
Join Date: May 2008
Posts: 5
what I understand is that primary keys are attribute that are used to uniquely identify the tuples of relation while the foreign keys link relations.This schema is meant to be in third normal form, for some reason I've been trying for days to get it into 3NF.

I recently managed to get it into 3NF but my lecturer told me to add in primary and foreign keys. which should be easy, but for some reason i can't wrap my mind around these two concepts .

My biggest mistake for the schema was failing to normalize the data.
Reply With Quote
  #4 (permalink)  
Old 05-01-08, 20:08
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
you understand PKs and FKs adequately

by the way, what language is that?

most databases use tables and columns

is that some kid of oops inheritance with the classes and attributes?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 05-01-08, 21:14
knucklebusster knucklebusster is offline
Registered User
 
Join Date: May 2008
Posts: 5
Quote:
Originally Posted by r937
you understand PKs and FKs adequately

by the way, what language is that?

most databases use tables and columns

is that some kid of oops inheritance with the classes and attributes?
SQL
yeah the schema contains inhertance.
It's acually a schema for an object oriented database it meant to define object class.
Reply With Quote
  #6 (permalink)  
Old 05-01-08, 21:44
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
that's SQL? whoa

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 05-01-08, 21:59
knucklebusster knucklebusster is offline
Registered User
 
Join Date: May 2008
Posts: 5
thanks hope i'm on the right track.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On