sql - Setting up primary keys in my tables? -


i have few tables generated different systems no unique identifier available on raw data.

several files same system can joined based on the:

interaction_time, customer_id, employee_id 

other files not include timestamp , there interaction_date. problem same customer can speak same employee on same day several times. using interaction_date, customer_id, employee_id not unique.

using python (pandas), find unique values of interaction_date, customer_id, employee_id. filter these rows separate dataframe , joins. data rows 1 customer interacted 1 employee 1 time on date. concat/append rows had multiple interactions post-joined data.

any recommendations on how set sql server? assume must common. building tables right , not sure primary key should be... composite key of date/customer_id/employee_id? how deal duplicates (these rows cannot joined other files because there no clear way tie data together)?

edit- wanted add tying granular data have. used tie survey (which might received weeks later) specific interaction, , tie file has length of interaction, , file has whether sale made on interaction, etc.

since interaction_time, customer_id, employee_id doesn't uniquely identify values in database, can 2 things:

1) don't make primary key @ (though bad practice)

2) make field call interaction_id uniquely determine interaction between consumer , employee. field can set auto-increment.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -