www.webdeveloper.com
Results 1 to 2 of 2

Thread: mySQL choosing proper data types?

  1. #1
    Join Date
    Jan 2005
    Location
    here! but there too...
    Posts
    53

    mySQL choosing proper data types?

    I have two tables, once is called departments, and the other is a seciton, when creating these tables i wanted to know what should i be looking for since each table will have it's onw primary key and an forign key...here's my structure so far:

    CREATE TABLE `dept` (
    `dept_id` int(11) NOT NULL auto_increment,
    `dept_name` varchar(255) NOT NULL default '',
    `section_id` varchar(255) NOT NULL default '',
    PRIMARY KEY (`dept_id`)
    ) TYPE=MyISAM

    =------------------------------------------------=

    CREATE TABLE `section` (
    `section_id` int(11) NOT NULL auto_increment,
    `section_name` varchar(255) NOT NULL default '',
    `dept_id` varchar(255) NOT NULL default '',
    PRIMARY KEY (`section_id`)
    ) TYPE=MyISAM



    ----------------------------------------------

    I want to know if i have the data types i have choosen are the right ones???

  2. #2
    Join Date
    Nov 2002
    Location
    Dartmoor [Holiday]
    Posts
    2,382
    The foreign keys should probably be the same type as the associated primary key, i.e. int(11) rather than strings.

    Adam
    "If youíre not using valid HTML, then you havenít created a Web page. You may have created something else, but it isnít a Web page." - Joe Clark

    Do something amazing (USA) | Make Poverty History

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles