SQL for not registering employees for conflicting appointments!


I was once asked by a fellow colleague if it was possible to have an SQL statement that would not allow employees from being registered to events that occur simultaneously.

Scenario

Consider a database that stores a list of persons and a list of events. Employees would eventually be registered as event attendees. It is possible that multiple events occur at the same time and therefore it is required that the SQL statement prevent any persons from being registered as attendees of conflicting events. It was required that the solution be all in one SQL statement for some reason whatsoever.

The SQL solution is found attached together with a supporting report! As always all feedback and queries are welcome!

Register employees for non conflicting events

Advertisements

3 thoughts on “SQL for not registering employees for conflicting appointments!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s