Have an account? Sign in
Login  Register  Facebook
Help Needed In MYSQL Normalization
Hey guys, need your help here. How best can i Normaliza the sql query on my last question
Started: September 17, 2011 Latest Activity: September 17, 2011 mysql php
1 Answer
i have great idea, why not separate this complex table to many tables
such as we will make just one main table

mysql Structure

CREATE TABLE `litorder` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `address` varchar(50) NOT NULL,
  `xdate` date NOT NULL,
  `ref` varchar(20) NOT NULL,
  `totalNaira` double(20,0) NOT NULL,
  `totalDollar` int(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `amount` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `litorder_id` int(11) NOT NULL,
  `amount` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `code` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `litorder_id` int(10) NOT NULL,
  `code` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `price` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `litorder_id` int(11) NOT NULL,
  `price` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


CREATE TABLE `product` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `litorder_id` int(11) NOT NULL,
  `varchar` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `quantity` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `litorder_id` int(11) NOT NULL,
  `quantity` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;



Posted: MacOS
In: September 17, 2011

Your Answer

xDo you want to answer this question? Please login or create an account to post your answer