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

Database design advise

$
0
0
I have a requirement to build an app and one area is to have an Employee who can hold multiple roles. I then need to get all employees by roles. Here is my database design

Role- id, roleName

Employee- id, name, surname

EmployeeRoles- id, roleId, employeeId

When the app is run the administrator would add the employee name and select all the roles that are applicable to the user. These roles are in the roles table so one employee could be IT, HR, Director, Marketing.

This information would be stored in the EmployeeRoles table.

Using this design means for me to get all roles for a particular employee I first have to query the EmployeeRoles table and get the employee ids and then make a second call to get the employee information.

Is there a better way to do this database design wise? I'm wondering if this database design is acceptable or if it can be improved? I don't think I would be able to create a View to have a join for both tables.






Viewing all articles
Browse latest Browse all 7129

Trending Articles