User tables and login details

Hi,
What is the best practice/recommended setup for user details and user login details in the Database when using Wappler? Is it better to have two tables? For example:

Table 1 - {users}: user_id; user_username; user_password; user_createddate
Table 2 - {users_details}: user_id; user_firstname; user_lastname; user_address1; user_address2; user_phone; etc

If we do have two table, how do we make the user_username unique so its not the same for any user?

Thank you.

You would setup a primary key in the users table and then use that same “key” as a foreign key in the users_detail table. You never want to have the same data in 2 tables

so in the end you would have
primary key = users.user_id
foreign key = users_details.user_id
with a 1:1 relationship

Thanks @sevenrice. I understand. Now in relation to my main question:

Q1) Is it best practice to have two seperate tables to house the user login and another table for user data?

Q2) How are people setting up username creation for their websites? Is it best practice to use their email address?

I’d recommend you have separate tables. It is a cleaner organization of your information especially when you grow the number of tables as you build and scale up.

I do indeed use email as the username. Emails are personal therefore unique and people remember them better than made up usernames.