Duplicate data

  • Hi I just have a problem and to be help..
    I have 2 tables storing information about lesson schedule and teacher of the lesson. as shown below :
    Table Schedule
    Date               Lesson        Teacher
    10-10-17        Math            
    10-10-17        English
    10-10-17        Sports
    10-11-17        Math
    10-11-17        English
    10-11-17        Sports

    Table Teacher
    ID     Teacher       Lesson   Priority
    001    Bob              Math       1
    002    Linda           Math        2
    003    Noah           Math        3
    004   Steve           English     1
    005   Bob              English     2
    006  Linda            English      3
    007   Steve           Sports       1
    008   Bob              Sports       2

    I need to put the teacher into the schedule with the condition only 1 teacher can teach on a day. The teacher is determine by their priority so if there are more than 1 teacher can teach the priority will determine which one can be filled. I've try many ways but still don't get the solution of the problems many thanks if there were can help me...

    thanks

  • joekanant 53667 - Monday, October 30, 2017 8:37 PM

    Hi I just have a problem and to be help..
    I have 2 tables storing information about lesson schedule and teacher of the lesson. as shown below :
    Table Schedule
    Date               Lesson        Teacher
    10-10-17        Math            
    10-10-17        English
    10-10-17        Sports
    10-11-17        Math
    10-11-17        English
    10-11-17        Sports

    Table Teacher
    ID     Teacher       Lesson   Priority
    001    Bob              Math       1
    002    Linda           Math        2
    003    Noah           Math        3
    004   Steve           English     1
    005   Bob              English     2
    006  Linda            English      3
    007   Steve           Sports       1
    008   Bob              Sports       2

    I need to put the teacher into the schedule with the condition only 1 teacher can teach on a day. The teacher is determine by their priority so if there are more than 1 teacher can teach the priority will determine which one can be filled. I've try many ways but still don't get the solution of the problems many thanks if there were can help me...

    thanks

    Add constraints to your schema which prevents multiple teachers on a single day.
    😎

  • could you give me the examples?

    thx

  • joekanant 53667 - Tuesday, October 31, 2017 1:51 AM

    could you give me the examples?

    thx

    Please post the DDL (create table) scripts, some sample data as insert statements and what you have tried so far. This makes it much easier to help.
    😎

  • Eirikur Eiriksson - Tuesday, October 31, 2017 2:14 AM

    joekanant 53667 - Tuesday, October 31, 2017 1:51 AM

    could you give me the examples?

    thx

    Please post the DDL (create table) scripts, some sample data as insert statements and what you have tried so far. This makes it much easier to help.
    😎

    And the expected results would be helpful too please.

    Thomas Rushton
    blog: https://thelonedba.wordpress.com

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply