First off, let me just say that I'm still a noob at this real world database stuff, and I was hoping to get some light shed on this situation.
I have recently put together a basic asp web application to manage a SQL database with two tables. The tables are as follows:
Key table:
Key_id Key_desc Key_number Key_location Issued_by Emp_id
Emp table:
Emp_id Emp_fname Emp_lname Emp_phone
As you can see, the tables are linked by the emp_id field. However, the key table allows for null values in the emp_id column in case the key is not assigned to an employee.
Since this is the case, I'm concerned about the overall relationship in the database, and orphan records are becoming a concern.
Since the key table allows for null values for that column, does this mean it is not in 1NF?
As of now, the web application assigns keys by pulling all records from the key table by selecting all records where emp_id is null, and then assigning an emp_id to a selected key.
But the relationship only exists if the key has an associated employee, and it seems like there must be a better way to do this.
It's probably a little late to change the app, so I'm more or less asking this out of sheer curiosity.
I thought I may need an assigned key table and an unassigned key table, but I don't know how I would link them with the current database fields. Can anyone give me some advice on this? Or maybe help me figure out a better way to link the database together?
My main concern is orphan records
This was typed on a mobile, so please forgive me if there are errors.
EDIT: Thanks a ton to those who responded to this. Ive got more help than I thought. Will mark an answer later on, when I figure out which route to take.
Something told me this was the right place to ask.