Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Thursday, August 9, 2012

Database Design Best Practices - part 1

Never create multiple tables for storing similar information.

Suppose, you are going to make an inventory software for a shop where you will need to store purchase, sales and transfer information. You have two choices.

One is to create multiple tables for "purchase", "sales" and "transfer" information.

Second is to make a common table for every transaction of products for all of the given type of transactions.

Second is better.

Example:

Bad Practice
table: purchase (pur_id, date, order_by)
table: sales (sales_id, date, order_by)
table: transfer (tr_id, date, order_by)

Best Practice
table: orders (id, date, order_by, order_type)

(Here, bracketed elements are the names of attributes or fields of the table.)

Friday, March 9, 2012

Real approach to install php/mysql on linux-apache web server

Hi, I have just found out that working on lampp in linux is not a real approach of working on PHP based software development. Recently, I need to use some multimedia encoder/decoders to compile some of my scripts, but lampp could not help me. We usually use lampp to install the whole working environment fast and in one click, but when we need some extra things to be included with this, it may not help and consume time to start.

I am using CentOS to make a real web server (for test scripts), it has a nice built in package manager YUM. I have already installed "Apache 2" for creating web server. It was easy and fast, apache (httpd) comes with centOS disks as default. I used the following line to install it.

yum install httpd

Then, I had to install php, php command line, perl, mysql to make the server ready for lamp development environment. This installation process required Internet connection and I used following line to install the whole thing.

yum install php php-cli mysql

It automatically searched all dependencies and the mirror from which they will be installed.

I didn't check the environment yet, but hope, it will help me fine.