Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

Sql coding question

$
0
0

Remember your old school.  How time table is prepared?

 Write a robust SQL query after defining necessary tables with enough dynamism and flexibility.

Guys please help to sort it out

 Following are the hints:

 

  1. Subject master

Subject ID

Subject Name

S1

Malayalam

S2

English

S3

Hindi

S4

Science

S5

Social Studies

S6

Mathematics

S7

Drawing

 

  1. Employee master (Teachers master)

Teacher ID

Teacher Name

Maximum number of periods to be taken in a week

T1

Sreekumar

15

T2

Prajesh

15

T3

Madhu

15

T4

Benoy

15

T5

Binu

15

T6

Nishanth

15

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  1. Teacher capabilities master (linking teacher to a subject)    

Subject Name

Teacher Name

Malayalam

Sreekumar

English

Prajesh

Hindi

Binu

Science

Nishanth

Social Studies

Benoy

Mathematics

Prajesh

Drawing

Madhu

 

 

 

 

 


 

  1. Classes and divisions master (requirement)

Class ID

Division ID

5

A

6

A

6

B

7

A

7

B

7

C

 

 

 

 

 

 

 

 

 

 

 

 

Given below are the logical points to be considered;

  1. 7 periods in a day, 5 days a week.
  2. One teacher cannot be present two classes at the same time and two teachers should not come in a class.
  3. All class must have a teacher.
  4. Maximum classes per week for a teacher as per teacher master.
  5. Teachers missing in a class not allowed.
  6. Not more than two continuous slots should be allocated for a particular subject in a day.
  7. Enough leisure period need to be planned for teachers.
  8. Keep same pattern of subject’s every-day to the best possible level (Eg. Class teacher will take first period every day)

 

Output

(Time table for 6A)  Hint: need to present liner records only, no pivot reqd.

Day

Period

ClassID

DivisionID

SubjectID

TeacherID

Monday

I

6

A

S1

 

T1

Monday

II

6

A

S3

T5

Monday

III

6

A

S5

T4

Monday

IV

6

A

S2

T2

Monday

V

6

A

S4

T6

Monday

VI

6

A

S6

T2

Monday

VII

6

A

S7

T3

Tuesday

I

6

A

S1

 

T1

 

 

 

 

 

 

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>