From:       To:      

Filtering Data for the Database Migration

It is very common situation when you do not need to migrate the entire table to another database format but just a part of it. Intelligent Converters software provide feature of filtering data for the database migration via SQL SELECT-queries for this purpose. With this feature, you can select particular columns or data subset or simply rename columns of the resulting table during the database migration. Below there are some examples of using SQL SELECT-queries for different purposes. Assume, we have MySQL table "Table1" defined as below:

   Table1(
	ID INT NOT NULL AUTO_INCREMENT, 
	FName VARCHAR(50),
	LName VARCHAR(50), 
	Birthday DATE, 
	Notes TEXT
   );

Example 1. Migrate certain records.

SELECT * FROM Table1 WHERE ID > 1000

Example 2. Select and rename certain columns.

SELECT FName as FirstName, LName as LastName FROM Table1

Example 3. Skip records containing NULL values.

SELECT * FROM Table1 WHERE Notes IS NOT NULL

Example 4. Merge two tables.

Assume, you have two tables defined as follows:

   ProductLines(
	productline VARCHAR(50), 
        description VARCHAR(1000), 
	image       MEDIUMBLOB
   );                              
   Products(
	code        VARCHAR(15), 
	name        VARCHAR(70), 
	productline VARCHAR(50), 
	vendor      VARCHAR(50), 
	descroption TEXT, 
	quantity    SMALLINT, 
	price       DOUBLE
   );

If you want to get product code and product name from the "Products" table and description of product lines from the "ProductLines" table, it is possible to be done using the following query:

SELECT code,
       name,
       description
FROM Products T1
INNER JOIN ProductLines T2 ON T1.productline = T2.productline;

As you can see, SELECT-query is a powerful feature to manage the data during the database migration. With this feature it is so easy to arrange incremental database migration and migrate the exact data needed. It would be useful for daily backup tasks and similar procedures requiring partial database migration.