If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > .sql files from modeler and MySQL dump command

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-05-08, 11:17
lmei007 lmei007 is offline
Registered User
 
Join Date: Jun 2008
Posts: 20
.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?
Reply With Quote
  #2 (permalink)  
Old 06-05-08, 11:27
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
You can declare FKs as part of the table definition or as a seperate constraint. Same thing.
Reply With Quote
  #3 (permalink)  
Old 06-05-08, 11:31
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,606
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
Reply With Quote
  #4 (permalink)  
Old 06-05-08, 16:23
lmei007 lmei007 is offline
Registered User
 
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.
Reply With Quote
  #5 (permalink)  
Old 06-07-08, 01:09
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,606
Then InnoDb is what you need to allow MySQL to honor/enforce constraints.

-PatP
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On