web development with NetBeans IDE larry's blog

Wednesday Jan 23, 2008

I think I know the real reason why Sun bought MySQL, and its got nothing to do with Oracle either. Its got everything to do with the fact that those GUI tools offered on the MySQL website are freakin awesome. At least a few of them suits at Sun possess some serious foresight. Very good work MySQL, but now look where its got you: you're as good as bought!

The best news is that all of these tools are FREE. Take MySQL Workbench for example. Its still in Beta, but who cares. I went and tried the following simple experiment to create a foreign key between 2 tables:

  1. Downloaded the ifpwafcad.sql script which is used in the NetBeans MySQL tutorial.
  2. In Workbench, chose from the File menu: Import > Reverse Engineer MySQL Create Script. I then pointed to the ifpwafcad.sql file. Workbench parses the script and the tables show in the Catalogue window:



  3. Then go to Model > Create Diagram from Catalog Objects and the tables show in the big window:



  4. Now, to create a foreign key between the Subject and Counselor tables, I clicked a Relationship button in the left sidebar. There's a bunch of them. Then clicked on the Subject table and then the Counselor table. I then proceeded to mess around.
  5. In the final step, the 2 tables are holding hands, there's a nifty feature that when you hover your pointer over the line, the relationship goes pink:




Finally, I wanted to create a new sql script from the changes made, that way I could inspect the code that was created by making the foreign key. To do so, File > Export > Forward Engineer SQL Create Script. In the generated script, the foreign key constraint looked like this:

  CONSTRAINT `counselor_idfk`
    FOREIGN KEY (`counselor_idfk` )
    REFERENCES `mydb`.`Counselor` ()
    ON DELETE NO ACTION
    ON UPDATE NO ACTION);
Comments:

hey guy's what this look what i have found an amazing mysql administrative tool sqlyog is making lot of noise just for free community edition than navicat. i played around with it and taking and took best. you???

Posted by john on June 24, 2008 at 02:03 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed