Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4335546
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:41:04+00:00 2026-05-21T10:41:04+00:00

I am trying to design a user table for MySQL. for now, my user

  • 0

I am trying to design a user table for MySQL.

for now, my user table looks like this

users (
BIGINT id,
VARCHAR(?) username,
VARCHAR(?) password,
VARCHAR(254) email,
DATETIME last_login,
DATETIME data_created
)

what other fields should I also include and why do I need them?

what fields should I exclude from above and why?

how many characters should I allocate for username and password, and why?

should I use BIGINT for id?

Thank you in advance for your helps.

ADDED
I am going to use the table for social web site, so ‘users’ mean people around the world.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:41:05+00:00Added an answer on May 21, 2026 at 10:41 am

    A few comments:

    1. BIGINT is fine. I assume you’re using it as a surrogate key. In that case, declare it as

      BIGINT id primary key auto_increment,

      Mysql will automatically allocate a unique int value to your id whenever you do an insert (don’t specify any value for this field). Never try to implement this behaviour by selecting the max id and adding 1 to it (I’ve seen this so many times).

    2. Length of username and password: this is no big deal really, just pick a length. I tend to standardise on 255 length varchars for these things but that’s not based on anything empirical.

    3. Call your table “user”, not “users”. Conceptually, a table implements an entity in the same way that a class implements an entity. You will likely create a class or data structure called “user” and the table name should correspond to this.

    4. Every table that I create has two timestamps, “created” and “last_updated”. You’re halfway there:)

    5. I don’t think I would store last_login in the user table, this is likely to be something that you will want to log in a separate table. It’s a good idea to store all login events (login, logout, failed attempt, account lock etc.) in a logging table. This will give you much better visibility of what the system has been doing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to design a location lookup in which the user can specify
I'm trying to design a data model that denotes one user being the friend
I'm trying to build out a mysql database design for a project. The problem
I am trying to see how test cases can drive interface design. Now, if
I'm trying to design some tables to store some data, which has to be
I'm trying to design an application based on the OpenSocial API , and I'm
I'm trying to design a model for a application allowing 2 people to bet
I've been trying to design a database schema for a side project but I
I'm trying to design a homepage for an MVC site that has two different
I'm trying to design a form which contains a dropdown box containing a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.