Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2008
    Posts
    20

    Unanswered: .sql files from modeler and MySQL dump command

    After I design my database by using a db software (powerDesigner), i created the result sql file and use that file created all tables in my MySQL database. after that I export all tables to a sql file by using the mysqldump command.

    After compare those two sql files, I found there are many differences.

    I the sql file from the software, there are some statements at the end, such as "alter table BankAccount add constraint FK_Reference_8 foreigh key (custId) references Customer (custId) on delete restrict on update restrict;".

    But I cannot find those statements on the exported sql file. In the exported sql file there is a statement inside the table creation block:
    KEY 'FK_Reference_9' ('custId')

    Are they the same thing? which one is better?

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    You can declare FKs as part of the table definition or as a seperate constraint. Same thing.

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Constraints are important parts of data modeling, they are what enforce integrity, etc.

    Most implementations of MySQL (based on the default installation) treat constraints as comments because of some default settings. Most versions of MySQL have the ability to support most kinds of constraints, it is just that their default configuration doesn't support constraints.

    You can post in the MySQL forum for help with this, or I could move this thread into the MySQL forum for you. The first thing that we would need to know in order to help you is what version of MySQL you are using. A copy of the script output by PowerDesigner would also help, but isn't absolutely necessary.

    -PatP

  4. #4
    Join Date
    Jun 2008
    Posts
    20
    Quote Originally Posted by Pat Phelan
    You can post in the MySQL forum for help with this, or I could move this thread into the MySQL forum for you. The first thing that we would need to know in order to help you is what version of MySQL you are using.
    -PatP
    If possible, please help me move it to MySQL forum.
    I use MySQL 5.0.45 on Windows XP machine.

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Then InnoDb is what you need to allow MySQL to honor/enforce constraints.

    -PatP

Posting Permissions

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