Why Do I need user id attribute?

JWayne93

I am currently trying to design a social network type of website and this is the class diagram
that I have so far

enter image description here

at the moment I have userId and username in separate tables because I wanted to normalize these tables but now I am not sure why do I need the userId attribute? I have done research and a lot of similar projects have this attribute but I don't get why? if the username is already going to uniquely identify a particular user.

By the way I am aware I have a problem with the requests table because at the moment with the attributes given I cannot identify a primary key Thanks

Matt Ball

Two big reasons I can think of:

  1. Optimization. SQL databases typically perform far better when using integer primary keys than varchar ones. Lookup-something-by-user is one of the most common operations in this environment, so this has real performance implications. Many DBAs don't like GUID/UUIDs as PKs for exactly this reason.
  2. Nothing dictates that a username must uniquely identify users. Case in point: Stack Exchange user handles don't have to be unique, and are freely editable.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Why Do I need user id attribute?

From Dev

Why do I need to use getter for a public attribute?

From Dev

Why do I need to escape < and & when rendering an attribute?

From Dev

Why do I need to subscribe user to topic in Firebase?

From Dev

Why do I need a strong password for my Ubuntu user account?

From Dev

Why do I need to initialise this variable before the user assigns a value to it?

From Dev

Why do I need FromBody Attribute when expecting data in POST body

From Dev

Why do I need a FactorySupplier?

From Dev

Why do I need dbus?

From Dev

Toggle a attribute with id 'user'+i with a checkbox with id 'checkbox'+i

From Dev

Why do I need to use the helper method create_user() inside of a TestCase in Django?

From Dev

Why do I need a dedicated user for a service (my git service: gogs / gitea)?

From Dev

Do I need to sanitize the user input Laravel

From Dev

Do I need to clear timeouts if user leaves?

From Dev

Need to get id attribute

From Dev

why do we need attribute grammar in semantic analysis?

From Dev

Why do I need to create a sharedInstance for audio?

From Dev

Why do I need "--expose" option in Docker?

From Dev

Why do i need to use minitest/autorun?

From Dev

Generic container: why do I need an interface?

From Java

Why do I need underscores in swift?

From Dev

Why do I need to call glClear in drawInRect?

From Java

Why do I need "store":"yes" in elasticsearch?

From Dev

Why do I need an NSRunLoop to run a timer?

From Dev

Why do I need permissions in my AndroidManifest?

From Dev

Why do I need source port on UDP

From Dev

Sections - why do I need backticks here?

From Dev

Why do I need depthBuffer to use RenderTexture?

From Dev

Prototype Pattern, why do I need an interface?

Related Related

  1. 1

    Why Do I need user id attribute?

  2. 2

    Why do I need to use getter for a public attribute?

  3. 3

    Why do I need to escape < and & when rendering an attribute?

  4. 4

    Why do I need to subscribe user to topic in Firebase?

  5. 5

    Why do I need a strong password for my Ubuntu user account?

  6. 6

    Why do I need to initialise this variable before the user assigns a value to it?

  7. 7

    Why do I need FromBody Attribute when expecting data in POST body

  8. 8

    Why do I need a FactorySupplier?

  9. 9

    Why do I need dbus?

  10. 10

    Toggle a attribute with id 'user'+i with a checkbox with id 'checkbox'+i

  11. 11

    Why do I need to use the helper method create_user() inside of a TestCase in Django?

  12. 12

    Why do I need a dedicated user for a service (my git service: gogs / gitea)?

  13. 13

    Do I need to sanitize the user input Laravel

  14. 14

    Do I need to clear timeouts if user leaves?

  15. 15

    Need to get id attribute

  16. 16

    why do we need attribute grammar in semantic analysis?

  17. 17

    Why do I need to create a sharedInstance for audio?

  18. 18

    Why do I need "--expose" option in Docker?

  19. 19

    Why do i need to use minitest/autorun?

  20. 20

    Generic container: why do I need an interface?

  21. 21

    Why do I need underscores in swift?

  22. 22

    Why do I need to call glClear in drawInRect?

  23. 23

    Why do I need "store":"yes" in elasticsearch?

  24. 24

    Why do I need an NSRunLoop to run a timer?

  25. 25

    Why do I need permissions in my AndroidManifest?

  26. 26

    Why do I need source port on UDP

  27. 27

    Sections - why do I need backticks here?

  28. 28

    Why do I need depthBuffer to use RenderTexture?

  29. 29

    Prototype Pattern, why do I need an interface?

HotTag

Archive