Does it make sense to have a table that does not reference any other in the database design?

I would like to get some database design tips. In particular, consider the following (hypothetical) scenario:

  • Employees - a table containing all data about employees
  • Users - a table in which employees who have a username and password to access the software are stored.
  • UserLog - a table to track user login and logout and calculate software time

alt text

, , , Users, . , ON DELETE CASCADE FK EmployeeID Employees Users.

UserLog, , , , .

UserLog, . ?

.. /googled online, , , , ...

.

+3
9

" " , "DeletedDate" "". UserLog, , , .

, .

+5

, . - , . ( ) / .

, . -. - , , .

. , - IsActive IsDeleted, , , .

+3

, , , UserLog , , , .

, , , - , , .

, , ( ) , .

+2

. , - employee - UserLog. , , , . ? . , ? , . - EmployeeID , . . , .

, , . , .., , . , ( , , ), , , , . . FK , , , .

Cascade Delete . , , , , , , FK , . , - .

+2

, , Users bool Deleted Disabled.

EmployeeId UserLog.

+1

, , . , , logintime, logouttime, sessionlength .

+1

? , , . , , - . , , , .

0

, , , . , . , "" , -.

, , , EmployeeID , Employee. , , . , , EmployeeID .

, active, , . , .

0

IANADBA, but it is generally thought that it’s very bad practice to really delete almost anything from the database ever. It would be much better to have some kind of locked flag / "remote" datestamp in your user table and save your FK.

0
source

Source: https://habr.com/ru/post/1781855/


All Articles