Results 1 to 2 of 2

Thread: user table

  1. #1
    Join Date
    Sep 2007
    Posts
    1

    Unanswered: user table

    hello dear friends i create a mysql database and a table i am new user of mysql so i create this database for user registration ...... but i want to know i create right table structure if not so please help me

    this is my table structure



    -- Table structure for table `user`
    --

    CREATE TABLE `user` (
    `ID` int(56) NOT NULL auto_increment,
    `UserName` varchar(35) NOT NULL,
    `Password` varchar(35) NOT NULL,
    `FullName` varchar(35) NOT NULL,
    `HomeAddress` varchar(35) default NULL,
    `City` varchar(35) NOT NULL,
    `Birthdate` datetime NOT NULL,
    `HomePhone` varchar(35) default NULL,
    `MobilPhone` varchar(35) default NULL,
    `Email` varchar(35) NOT NULL,
    `Picture` varchar(56) NOT NULL,
    `Designation` varchar(35) NOT NULL,
    `DepartmentID` varchar(35) default NULL,
    `Session` varchar(35) NOT NULL,
    `ProgramName` varchar(35) NOT NULL,
    `LifeAchivements` varchar(35) default NULL,
    `ProfessionalLife` varchar(35) default NULL,
    `Survey2` varchar(35) default NULL,
    `Survey3` varchar(35) default NULL,
    `Survey4` varchar(35) default NULL,
    `Survey5` varchar(35) default NULL,
    `Group_id` varchar(35) NOT NULL,
    PRIMARY KEY (`ID`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;

    --
    -- Dumping data for table `user`

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    ...
    `Survey2` varchar(35) default NULL,
    `Survey3` varchar(35) default NULL,
    `Survey4` varchar(35) default NULL,
    `Survey5` varchar(35) default NULL,
    ...
    This is incorrect.
    You will want to create a second table for Surverys with a foreign key reference to the user table.
    E.g.
    Surveys(SurveyID, StudentID, OtherAttributes....)

    More on normalization here
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •