Jump to content

Recommended Posts

Hy guys i have a bit of a dilema here i am making a MySQL table  and i have 2 tables.

 

CREATE  TABLE IF NOT EXISTS `Forum`.`user_hash` (
  `user_ID` INT(10) UNSIGNED NOT NULL ,
  `username` VARCHAR(45) NOT NULL ,
  `user_is_online` TINYINT(1) NOT NULL ,
  `password_hash` VARCHAR(40) NOT NULL ,
  `usergroup_id` SMALLINT(5) UNSIGNED NOT NULL ,
  `avatar_loc` VARCHAR(250) NULL ,
  `energy` INT(7) UNSIGNED NOT NULL DEFAULT 26 ,
  `reputation` INT(7) UNSIGNED NOT NULL DEFAULT 1 ,
  `Broj_odgovora` INT( UNSIGNED NOT NULL DEFAULT 0 ,
  `zadnji_login_u` TIMESTAMP NOT NULL ,
  `user_tema` INT(3) NOT NULL ,
  `pocetna_stranica` INT( UNSIGNED NOT NULL DEFAULT 1 ,
  `downloadovao_kolicina` INT(10) UNSIGNED NOT NULL ,
  `broj_downlaoda` INT(10) UNSIGNED NOT NULL ,
  PRIMARY KEY (`user_ID`) ,
  INDEX `fk_user_id` (`user_ID` ASC) ,
  INDEX `fk_CSS_tema` (`user_tema` ASC) ,
  INDEX `username` (`username` ASC, `user_ID` ASC) ,
  INDEX `pocetna_stranica` (`pocetna_stranica` ASC) ,
  INDEX `usergroup` (`usergroup_id` ASC) ,
  CONSTRAINT `fk_user_id`
    FOREIGN KEY (`user_ID` )
    REFERENCES `Forum`.`user_data` (`user_ID` )
    ON DELETE CASCADE
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_CSS_tema`
    FOREIGN KEY (`user_tema` )
    REFERENCES `Forum`.`CSS_stil` (`ID_stila` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `pocetna_stranica`
    FOREIGN KEY (`pocetna_stranica` )
    REFERENCES `Forum`.`meni_stranice` (`ID_stranice` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `usergroup`
    FOREIGN KEY (`usergroup_id` )
    REFERENCES `Forum`.`usergroup` (`usergroup_ID` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB

 

and another one

CREATE  TABLE IF NOT EXISTS `Forum`.`user_data` (
  `user_ID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
  `dan_registracije` DATE NOT NULL ,
  `registarcioni_IP` INT(12) UNSIGNED NOT NULL ,
  `locked_ip` BINARY NOT NULL DEFAULT 0 ,
  `banovan` TINYINT(1) NOT NULL DEFAULT false ,
  `GMT_time` INT(2) UNSIGNED NOT NULL ,
  `mail` VARCHAR(120) NOT NULL ,
  `pol_korisnika` TINYINT(1) NOT NULL COMMENT 'true je male, false female XD' ,
  `msn` VARCHAR(120) NULL ,
  `yahoo` VARCHAR(120) NULL ,
  `alm` VARCHAR(120) NULL ,
  `ICQ` VARCHAR(120) NULL ,
  `facebook` VARCHAR(120) NULL ,
  `gmail` VARCHAR(120) NULL ,
  `homepage` VARCHAR(240) NULL ,
  `show_mail` TINYINT(1) NULL DEFAULT false ,
  `show_other_mails` TINYINT(1) NULL DEFAULT false ,
  PRIMARY KEY (`user_ID`) ,
  INDEX `mail` (`mail` ASC) )
ENGINE = InnoDB

 

The names are on Serbian but that duos not mater. I am in a  dilemma here, is it good practice to keep the data that is by its nature big and not regular like alternate user data which is in the second statement in a separate table and the usually called and often accessed.

My question is. Is it  better to keep those data in a single table or, in separate ones?

Link to comment
https://forums.phpfreaks.com/topic/192837-what-is-bether/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.