Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

creating a database structure.

 
Ranch Hand
Posts: 113
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i got below question on an interview recently
-------------------------------------------------------------------
Create a database table and coulum structure and write a sql query for a school.
where one student can be taught by many teachers , one teacher can taught many subjects, and a student participate in learning various subjects from differnt teachers.

Management wants to generate a report on like how many students a teachers teaches and which subjects. l
1000 students 200 teachers 15 subjects.

---------------------------------------------------------------------
The problem is all relation between student, teachers and subjects are N:N and
since it is N:N relation beteen student and teachers, students and subjects , teachers and subjects. i startedde creating some thing below

Student table : Stud_id, name
Teacher Table : Teacher_id , name
Subject Table : Subjet_id, subject name.

now i was thinking to have a joiner table( to achieve N:N relationship)

Joiner_Student_Teacher table : ST_id, stud_id, teacher_id.
Joiner_Student_Subject table : SS_id, Stud_id, Subject_id,
Joiner_Teacher_Subject table : TS_id, Teacher_id, Subject_id.



is this database design correct for above kind of Student-Teacher-Subject Model. please give your valuable suggestions.




 
No more fooling around. Read this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic