During the development cycle of data model, several changes/updates may take place over time depending upon the needs and requirement of that project. As and when required, different data model versions will be created with little or more changes between them. At one point of time, one may require to know the exact differences between different versions(older version and newer version) of data models. Knowing these will help in assuring the updates in the newer version are correct and staying intact with the needs of the requirement. Also you can apply these changes to the underlying database by creating “ALTER” scripts. In that case, data modeling tools can help us to sort out the differences between data models.
With the help of a data modeling tool you can compare:
In this article, we are using Toad software to compare between two different data model versions as well as to create ALTER scripts for database update.
Note: In Toad Data Modeler Software, data models are saved with file extension of .txp.
The following table represents a data model with a file name “Domain_Rule_Default_v1.txp” in the first stage of a development of a data model.
Column Name | Data Type |
---|---|
FULL_NAME | NAME_DOMAIN NN |
STREET_NAME | NAME_DOMAIN NN |
CITY_NAME | NAME_DOMAIN NN |
GENDER | Char(1) NN |
SSN | Char(9) NN |
RECORD_DATE | Date NN |
USER_NAME | NAME_DOMAIN NN |
In the second stage of a development of a data model, you are requested to add another column “COUNTRY_NAME VARCHAR2 (30) NOT NULL)”.
Follow the guidelines below to insert the requested column in the data model using Toad Software.
The following table represents the data model “Domain_Rule_Default_v2.txp” created in the second stage of a development of a data model.
Column Name | Data Type |
---|---|
FULL_NAME | NAME_DOMAIN NN |
STREET_NAME | NAME_DOMAIN NN |
CITY_NAME | NAME_DOMAIN NN |
GENDER | Char(1) NN |
SSN | Char(9) NN |
RECORD_DATE | Date NN |
USER_NAME | NAME_DOMAIN NN |
COUNTRY_NAME | Varchar2(30) NN |
For comparing the data models:
How to generate Alter Script after comparing the data models?
Finally, the script generated by TOAD as follows:
ALTER TABLE “DOMAIN_RULE_DEFAULT” ADD (“COUNTRY_NAME” Varchar2(30) NOT NULL)
Learn data modeling design Skills on OLTP and OLAP from a US University Professor with…
These SQL commands are related with Oracle's data dictionary and can be used to get…
important DDL Statements from Oracle like Commit, Rollback, Grant, Revoke etc..
In this section, we will try to explain about important database DROP commands that are…
In this section, we will try to explain about important database DML commands that are…
In this section, we will try to explain about important database ALTER commands that are…