background preloader

Database

Facebook Twitter

Tables - phpBB Development Wiki.

PhpBB

Sql - Is there a standard implementation of a Users Database? - Database Administrators. Going to have to go for a big old fashion "it depends". Of course you are going to need some sort of key on this table. You could start off with a UserID. This could just be a incrementing INT (or bigint if you are going to have over 2.1 million users). I've seen lots of databases also use GUIDs as the main UserID. But that's opening a whole different can of worms using GUIDs for PKs. You then need to decide how normalized you want your database. I'd keep the main user table to: some sort of ID or PK you can useFirst Name/Last Name or just a usernamesome sort of status of the user (active, disabled, etc) - (tinyint linking to a status table)created date That should be your starting point. From there you could add other columns based on what you want to store.

I HIGHLY recommend you read this article though - Disk Is Cheap! ORLY? At various times in my database-oriented career I have had conversations with people regarding what datatype to use for a particular field (or some other data modeling question), resulting in them discounting my desire to use a smaller datatype and exclaiming: Disk Is Cheap! I'm sure you have heard this as well so I figured I would share why this phrase confounds me. I find that people uttering such a phrase usually have not thought about the implications of what it really means. From what I gather, the unspoken meaning of the phrase is grounded in factual information that is out of context. By that I mean the cost of storage 30 years ago (70s and 80s) was so great that people conserved bytes whenever possible and the world ended up with the Y2K bug as a result.

Today the price of a Gigabyte of disk space doesn't truly matter when we are measuring in Gigabytes to begin with. There are actually two meanings to "Disk is Cheap": financial cost and I/O cost. But wait, there's more! Database design - Best practices on common person fields (Name, email, address, gender etc...) - Database Administrators. My bum is getting sore from sitting on the fence, so I am going to just throw out some answers and hope to not get down-voted into oblivion.

Please offer constructive criticism. E-mail Address: min: 6 (a@g.cn) . Or 3 if you want to track local domain email addresses max: 320 254 (RFC) The amount of code to validate an email is actually insane, so let's just assume it's valid if it has a "@" You may want to abstract an email address as a "communication method", so that you can easily list all methods with which to communicate with a user. Gender Gender can change over time, so you could track that if it's important to you. Addresses: NORAM I am gonna take the cheap way out and stick to North American addresses.

It is convenient to abstract countries, divisions, cities, and counties mostly due to taxation. GeographicArea: id: int type: {country, division, county, city, indian reservation} name: varchar(45) [1] abbreviation: nullable varchar(4) parent_id: nullable int Address: PartyAddress Names. Ten Common Database Design Mistakes. No list of mistakes is ever going to be exhaustive. People (myself included) do a lot of really stupid things, at times, in the name of “getting it done.” This list simply reflects the database design mistakes that are currently on my mind, or in some cases, constantly on my mind. I have done this topic two times before. If you’re interested in hearing the podcast version, visit Greg Low’s super-excellent SQL Down Under.

Before I start with the list, let me be honest for a minute. So, the list: Poor design/planning Ignoring normalization Poor naming standards Lack of documentation One table to hold all domain values Using identity/guid columns as your only key Not using SQL facilities to protect data integrity Not using stored procedures to access data Trying to build generic objects Lack of testing Poor design/planning “If you don’t know where you are going, any road will take you there” – George Harrison Ignoring Normalization Are there always 12 payments?

Poor naming standards Security.