Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

complex table column type

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suppose I want to create 2 tables -- Department, Student

Student {
name,
id,
address
}

Department {
Dept_name,
Students[] student,
}

in which "department" table contains a group of "student".

How to do the "create table" statement for "department" ? Please help.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your case it is prefarable to create the tables like :

Create table Dept(
Dept_id number,
Dept_name varchar2(20),
CONSTRAINT DEPT_DEPTID_PK PRIMARY KEY (DEPT_ID));

Create table Student(
stud_Id number,
Stud_Name Varchar2(50),
...
Dept_id Number,
CONSTRAINT STUDENT_STUDID_PK PRIMARY KEY (STUD_ID),
CONSTRAINT STUDENT_DEPTID_FK FOREIGN KEY (DEPT_ID)REFERENCES Dept(Dept_id)
);
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic