Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners
Testimonials
Peter W Rasmussen: "Just checking out on MySQL Maestro - really nice product".
Renaud Lepage: "I was searching for a powerful server management as well as data management application, that could also have the ability to use stored procedures (MySQL5). I was using many separate apps. And then I stumbled upon this application. It just got better. With ease-of-use, powerful management, a very good level of customization, great MySQL server management and the very lushed graphical interface, MySQL Maestro is a product to consider seriously. I chose MySQL and this, to SQL Server 2000 and the MMC-integrated server management, for use in a programming course. I'm telling you, MySQL Maestro is a very powerful tool. Try it, you won't regret it".

More

Add your opinion

SQL Maestro for MySQL online help

Prev Return to chapter overview Next

Split table

It's not an uncommon situation when new requirements arise, or when you need to enforce referential integrity on a set of columns, and the best decision is to split a table into two separate tables. SQL Maestro for MySQL provides you with Split Table Wizard, a simple tool to generate a bunch of SQL scripts to modify the primary table, to create a secondary table with a primary key, and to transfer data from the primary table to the secondary one without duplicating of data. To invoke the wizard, follow the corresponding link of the Generate SQL section of popup menu of the selected table at the Explorer tree.

 

 

Let's see the wizard in action on the example of a table with the following SQL definition:

 

CREATE TABLE person (

  id         integer NOT NULL,

  city       varchar(30) NOT NULL,

  full_name  varchar(30) NOT NULL,

  /* Keys */

  CONSTRAINT person_pkey

    PRIMARY KEY (id)

);

 

The table stores sample data:

 

 

To enforce the referential integrity, we specify 'city' as secondary table:

 

 

The primary table must contain now only 'id' and' full_name' columns. The field 'city_id' will be added to the table automatically.

 

Now we have to specify what kind of primary key to be created for the secondary table: surrogate or natural. We create create the 'city' table with a surrogate primary key.

 

 

Then click Ready and get the following tables:

 



Prev Return to chapter overview Next