0

this is my first time working with DB in android. So I figured I would follow this tutorial http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/

As you can see, it makes you create a DB which as both an ID and something called UNIQUE_ID (there's even a function in PHP which creates a unique identifier)

ID is the primary key UNIQUE_ID is set as UNIQUE

my question is. why do I need both? which one do I use for foreign keys?. Which is the point of having such a long a complicated ID?

Thanks In advance

frankelot
  • 13,666
  • 16
  • 54
  • 89

1 Answers1

0

The first ID it is the primary key for the table which is mainly a unique counter that updates every time a new row is created. It will keep increasing even if the row gets deleted.

UNIQUE_ID is an identifier created to keep track of users; think of it as if it were a unique username field

Emmanuel
  • 13,083
  • 4
  • 39
  • 53