Jump to Menu

Altering the nullable of column from ERD

In a database table, a nullable column is one that can have no value assigned to it when inserting or updating a record. On the other hand, a non-nullable column is a column that must have a value assigned to it.

Visual Paradigm provides a convenient way to modify the nullable property of a column and directly update your database schema. In this tutorial, we'll show you how to modify the nullable property of a column in an Entity Relationship Diagram (ERD) and update your database schema using the "Update Database" feature.

Please note that this tutorial assumes a fundamental understanding of database modeling with ERD and database engineering.

Compatible edition(s): Enterprise, Professional, Standard

  • August 16, 2010
  • Views: 37,997
  • PDF

Setting up your database

MySQL will be used as database software throughout this tutorial. You can, however, use any other types of database products that Visual Paradigm supports. Once you are familiar with the database software you are using, you will not find it hard to complete this tutorial.

Before you start, create a database. Name it myshop.


create db

Configuring your database

  1. Create a project with Visual Paradigm. Select Tools > Database > Database Configuration... from the main menu.
  2. In the Database Configuration dialog box, select the database software you use from the list. In this tutorial, check MySQL.
    select db
  3. In the Database Setting panel, press on the upside down arrow button next to Driver file field.
    download driver
    If your database provider does not support downloading driver file, the pop-up Download dialog box will notify you that the database software is not available and provide a link for downloading the driver file. Alternatively, you can refer to Database Driver Description section. There shows you the link for downloading the driver file.
    db driver desc
  4. Fill in the connection information to connect to database. Enter myshop as database name. For MySQL DB users, select InnoDB as engine to keep the relationships among entities when generating database.
    connection info
  5. Finally, check on Test Connection to verify the connection. Click OK to close the configuration dialog box.

Drawing an ERD

  1. Create an ERD. Right-click on Entity Relationship Diagram in Diagram Navigator and select New Entity Relationship Diagram from the pop-up menu.
    new erd
  2. Immediately name the diagram as MyShop ERD at the top left corner. Keep Physical Model selected at the top right corner.
  3. Create an entity. Press on Entity in diagram toolbar and drag it on the diagram. Name it as Product and press Enter to confirm.
    create product
  4. Let's add columns to the entity. Right-click on Product and select New Column from the pop-up menu. Enter +id:int as name (note: The plus sign is to indicate that this is a Primary Key column). Press Enter.
    new col
  5. Next, add another column name : varchar(255). The entity now turns into the image as shown below:
    completed erd
  6. Right-click on the name column. You can see that the option Nullable is checked. This means that you can enter nothing for product name when inserting or updating a product record.
    nullable col

Generating database

  1. Select Tools > Database > Generate Database... from the main menu.
  2. In the Database Code Generation dialog box, select Export to database and Generate sample data. If you do not select them, both database and sample data will not be created in database.
    export to db
  3. Click OK to start generation.

Checking your database

You can now check yor database, to see if the name column was generated as nullable or not. Here is a screenshot captured under MySQL.


col nullable

Altering the nullable setting

  1. Now, go back to the diagram. Right-click on the name column and de-select Nullable from the pop-up menu. Immediately, the symbol "N" does no longer appear in the entity shape.
    de select nullable
  2. To update database, select Tools > Object-Relational Mapping (ORM) > Generate Database... from the main menu.
  3. In the Database Code Generation dialog box, select Update Database for the action to perform.
    db generation
  4. Click OK to start updating database.
  5. Check the database again. This time, you can see that the name column is no longer nullable.
    change nullable


Turn every software project into a successful one.

We use cookies to offer you a better experience. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.

OK