The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 6 of 6

Thread: mySQL HELP!!

  1. #1

    mySQL HELP!!

    here's the code! i need help with this! can anyone tell what's wrong with it!
    here's the error i get: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'not null, type_id int(11) NOT NULL, description int NOT NULL, P


    CREATE TABLE events (
    event_id int not null AUTO_INCREMENT,
    dept_id int not null,
    section_id int not null,
    oo_id int not NULL,
    location_id int not null,
    action_id int not null,
    date_from DATETIME not null,
    date_to int not null,
    title varchar not null,
    type_id int(11) NOT NULL,
    description int NOT NULL,
    PRIMARY KEY (event_id)

  2. #2
    I think you're missing the length of the varchar in there... If you don't specify the length into the int type fields, it will be set to the default value(11 when I tested it), but varchar does not get set to the default value...
    So, I just added some number and it did create the table...
    title varchar(50) not null,
    CyanBlue / Jason Je / Flash Developer

  3. #3
    Oh ok thanks, here's what i changed it too now.

    CREATE TABLE `events` (
      `event_id` int(11) NOT NULL auto_increment,
      `dept_id` int(11) NOT NULL default '0',
      `section_id` int(11) NOT NULL default '0',
      `oo_id` int(11) NOT NULL default '0',
      `location_id` int(11) NOT NULL default '0',
      `action_id` int(11) NOT NULL default '0',
      `date_to` datetime NOT NULL default '0000-00-00 00:00:00',
      `date_from` datetime NOT NULL default '0000-00-00 00:00:00',
      `title` varchar(100) NOT NULL default '0',
      `type_id` int(11) NOT NULL default '0',
      `description` varchar(255) NOT NULL default '',
      `user_id` int(1) NOT NULL default '0',
      `project_manager` int(1) NOT NULL default '0',
      `other_contact` int(1) NOT NULL default '0',
      PRIMARY KEY  (`event_id`),
      KEY `dept_id` (`dept_id`,`section_id`,`oo_id`,`location_id`,`action_id`,`date_to`,`date_from`,`title`,`type_id`,`description`,`user_id`,`project_manager`,`other_contact`)
    P.S. I'm using EMS mySQL, and i wanted to create foreign keys, but i would rather perfer to have it done visually using EMS, but when i try and drag the PK of a table to this MAIN - EVENTS table where say dept_id is included aswell, i get an error that it only supports InnoDB, but how do i change that to have it support innoDB????


  4. #4
    AHHHH I'm going crazy, how do you convert ISAM to InnoDB!!!!!!!!!!!!!!!!!

  5. #5
    with mysql you should create the foreign keys with a join in the select statement. FK's isn't well supported (yet) in MySQL.


    a inner join (only returns a result when there's a match with the keys):
    "SELECT * FROM table1,table2 WHERE;"

    or a left join (this on also shows results, even when there's no fk linked to it)
    "SELECT * FROM table1 LEFT JOIN table2 ON;"

    make sure you have an index on your fk, otherwise the mysql load can get pretty high with big queries.

  6. #6
    basically what i want to do is use the INNER JOIN for select queries, which is what it does, and of course i've read that it's not good practice to use foreign key's and JOINS together...

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

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012