Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Other Topics > Computer Technical Help
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-06-2007, 04:17 AM
wporter wporter is offline
Senior Member
 
Join Date: Jun 2004
Location: Auburn
Posts: 159
Default Oracle database help?

i am currently working on a project in one of my classes that deals with building a database using oracle, is anyone familiar with this? i need some help with some things, let me know. thanks alot!
Reply With Quote
  #2  
Old 03-06-2007, 01:43 PM
dcasper70 dcasper70 is offline
Senior Member
 
Join Date: Mar 2005
Location: Life Has Come From My Balls
Posts: 3,526
Default Re: Oracle database help?

Whatcha need? Details please.

I've done a good amount of oracle stuff, but it's a such a huge beast that I may be only able to point you in a direction....
Reply With Quote
  #3  
Old 03-06-2007, 04:07 PM
wporter wporter is offline
Senior Member
 
Join Date: Jun 2004
Location: Auburn
Posts: 159
Default Re: Oracle database help?

yeah im just doing a project thats pretty simple. we just have like 9 tables, and gotta have them connected by PK's and FK's, we also need some sequences and triggers. i just cant figure out what the point of a sequence is, and im havin some problems with the trigger. think you could help?
Reply With Quote
  #4  
Old 03-06-2007, 04:33 PM
dcasper70 dcasper70 is offline
Senior Member
 
Join Date: Mar 2005
Location: Life Has Come From My Balls
Posts: 3,526
Default Re: Oracle database help?

A sequence is actually pretty handy.
Say you have a unique ID field, let's call it Emp_Num (employee number), and every time you insert a new employee you want to give them the next ID number.
Instead of getting the Max(Emp_Num) + 1 in the employee table, just create a sequence. It will keep an incremental list for you.

So an insert can be
Insert into Employee (EMP_NUM, F_NAME, L_NAME)
Values
seqEmployee.NextVal,'Willy','Porter';

Or something like that.


What are you doing with the trigger?
Reply With Quote
  #5  
Old 03-06-2007, 04:41 PM
wporter wporter is offline
Senior Member
 
Join Date: Jun 2004
Location: Auburn
Posts: 159
Default Re: Oracle database help?

im still trying to figure it out. this is my first database class, and this is our first example. we have a college situation where we have 9 tables, students, departments, faculty, etc. he wants us to have students and classes and to be able to show student schedules. he wants sequences and triggers. the trigger has an audit log which keeps track of the old grade, new grade, user, and sysdate. i have somewhat of an idea on the code for the trigger, but im really confused about some of the simple stuff like which FK should go where, and im not sure my ERD model is correct either. does this sound simple to u?
Reply With Quote
  #6  
Old 03-06-2007, 04:53 PM
dcasper70 dcasper70 is offline
Senior Member
 
Join Date: Mar 2005
Location: Life Has Come From My Balls
Posts: 3,526
Default Re: Oracle database help?

[ QUOTE ]
does this sound simple to u?

[/ QUOTE ]
yes

Hey, your an Oracle noob. Gotta start somewhere...


Feel free to pm me or post some more specific stuff.
Reply With Quote
  #7  
Old 03-06-2007, 07:14 PM
ohgeetee ohgeetee is offline
Senior Member
 
Join Date: Jun 2004
Location: ATL
Posts: 840
Default Re: Oracle database help?

for your assignment, every table is going to need a PK or primary key. This is a column that is unique, that you can use to narrow down data later. in the students table, you might think to make name unique at first, but think of how many Jim Smiths there will be, and even keeping middle name there will still be dupes. Using a sequence on a student# field would work best.

for department, you could use a dept ID that is unique, or dept name if there wont ever be departments that are the same name. Most DB purists will say to always use a sequenced ID field.

when coming up with foreign keys, you need to figure out what type of relationship the items have. 1 to 1, 1 to many, or many to many. 1 to 1 are items generally in the same table, so 1 to many and many to many are the 2 types you will be dealing with. For instance classes. classes can have many students, but students can only take the class once, generally. this means that in your class table, you want your student_id field as a foreign key.

many to many is a bit trickier, it takes a middle table to allow the many - many link. lets say a teacher could belong to multiple departments for some reason, and of course a department could have multiple teachers. to setup this relationship, you would have teacher table with teacher_id as its pk, department table with department_id as its pk, then a table called teacher_department that has teacher_id and department_id, which tracks the links.

pk's define tables, fk's define relationships
Reply With Quote
  #8  
Old 03-06-2007, 08:30 PM
dcasper70 dcasper70 is offline
Senior Member
 
Join Date: Mar 2005
Location: Life Has Come From My Balls
Posts: 3,526
Default Re: Oracle database help?

OP pm'd me a list of tables and pks/fks.

Here's what it looks like graphically:
Reply With Quote
  #9  
Old 03-06-2007, 10:21 PM
buckslayer80 buckslayer80 is offline
Senior Member
 
Join Date: Feb 2006
Location: Waiting for GOW3
Posts: 1,010
Default Re: Oracle database help?

LOL Oraclements [img]/images/graemlins/shocked.gif[/img]
Reply With Quote
  #10  
Old 03-06-2007, 10:42 PM
kerowo kerowo is offline
Senior Member
 
Join Date: Nov 2005
Posts: 6,880
Default Re: Oracle database help?

Shouldn't a class have a department?
Reply With Quote
Reply


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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:16 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.