2011-08-01

Let's Make Database Tips 1

Mysql is make it position as one of the best DBMS for web / online. The fitur in Mysql is not as good like Oracle, but it seem PHP the most web programing languages kinda attached to Mysql.
And all cms I see and use (joomla) using this DBMS for database. Is Free and we can use it without affraid get busted because license. But with Free License we don't have the full power from mysql. But without license, we already have what we want! Until we play some restricted data or complex data!

From my PoV, before play or save our data, we need to construct the database or called as building. The problematic in create DB is the data isn't valid?! and to make valid and constructed better, we need Normalizations.

For short, You don't need to create a massive table (field) to save a small data. But you should create something you can easy to edit (update), save(insert) dan called (select)!! How about delete? well That's something to read carefully.

I have programing that have 50!! fields, but i able to reduce it to small fields.. I will share later but be wise, there no perfect in the script/method for shrink the fields.  .
In this page, I will explain to you about how to database for a better use. tips I make are:
  1. give a better name for database, table and field. This tips will explain in this post.
  2. Never/do not delete data in table database.
  3. every table must have id
  4. create 2 kind of table, master table and master detail table
  5. remember to make backup to your database.

Let's begin with the first step.. Give a Better name for database, table and field will explain later.

Give Better name for Database
If you make script in local or place you can have access to build your own database, you will need this. But if you don't have access.. You can take the last advise! Perhaps today you just dealing with 1 or 2 programing? or perhaps small. but don't see today, see future.. Perhaps 1-2 years you will have 100 programing and each progrm have 1 DB!!

The program you built is not the same, example there are a game, study and work. If you named like you wanted, perhaps it will be hard if you have more than 10 database you need to work!!

For me, I work on Clinic application, but since this is for work, I can named work.. but this is wrong, if I have 100 work.. I will be have Work1,Work2 etc!! The worst I don't know which Database I use for Work, I maintenance nowtoday!!

Make sure type small for the name.
My fellow friend in Forum said about case sensitive, he can't access his database because misspelling and type the table. And you know, is happen for database too. The script is case sensitive, to avoid that you need a rule. A basic rule is don't use kapital!

Create a prefix
You happen to install Joomla and see the field named like jos_user ??
Jos_ is prefix, that prefix is essential to make your database is better. For security and better structure we should using this prefix as part of database name. I use to named my project database as
work_nasgor 
Nasgor or Nasi Goreng is just programing name I use, Work represented this table are for work. If I happen to make nasgor database but for fun, I should make
 fun_nasgor

Tips for Table and Field is same as above, but if you don't have acces to make the name like above, try to make/named your database with type programing you deal now. What happen if we do have only 1 database.. Is posible but we will talk about table after next page

Tidak ada komentar: