---
title: "3 Top Rules to Become a Primary Key in DB2 Table"
description: "These Table column properties are desirable to get eligibility for Primary Key in DB2."
url: https://srinimf.com/2016/08/04/how-db2-primary-key-differ-from-other-rdbms-databases/
date: 2016-08-04
modified: 2026-10-07
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2016/08/pexels-photo-2239672.jpeg?fit=1880%2C1212&ssl=1
categories: ["DB2"]
tags: ["DB2 Primary Key eligibility criteria"]
type: post
lang: en
---

# 3 Top Rules to Become a Primary Key in DB2 Table

The primary key is part of the Table definition. There is one primary key is allowed for each table. And the columns contained in a primary key cannot have [null values](https://srinimf.com/2024/09/10/pyspark-dataframe-counting-null-values-in-each-column/).

## **The [primary key in](https://srinimf.com/2010/07/22/db2-how-to-find-primary-key/) DB2**

A primary key constraint forbids duplicate values in one or more columns. A table with a primary key will be considered the parent table to a table with a foreign key, which becomes the dependent table.

Related[DB2 Check Vs. Default Constraint Top Differences](https://srinimf.com/2021/10/30/db2-check-vs-default-constraint-top-differences/)

### **3 Rules**

- Primary must be defined while creating Table
- Only one Primary key is allowed
- The primary key column must not allow [null values](https://srinimf.com/2024/11/04/4-top-scenarios-handle-null-values-in-pyspark/)

**Note:** A nullable column cannot be a part of a primary key.

Related

- [Mainframe: How to find Primary Key in Zos DB2](https://srinimf.com/2010/07/22/db2-how-to-find-primary-key/)DateJuly 22, 2010
- [DB2 Tutorial For Software Developers (1 of 5)](https://srinimf.com/2010/03/17/mainframe-db2-tutorial-for-software-developers-1-of-5/)DateMarch 17, 2010
- [Here are Top Questions – Useful for DB2 Certification](https://srinimf.com/2018/04/19/db2-certification-questions/)DateApril 19, 2018

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2016%2F08%2F04%2Fhow-db2-primary-key-differ-from-other-rdbms-databases%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2016%2F08%2Fpexels-photo-2239672.jpeg%3Ffit%3D1200%252C774%26ssl%3D1&description=%3Cstrong%3E3%20Top%20Rules%20to%20Become%20a%20Primary%20Key%20in%20DB2%20Table%3C%2Fstrong%3E)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2016/08/04/how-db2-primary-key-differ-from-other-rdbms-databases/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2016/08/04/how-db2-primary-key-differ-from-other-rdbms-databases/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2016/08/04/how-db2-primary-key-differ-from-other-rdbms-databases/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2016/08/04/how-db2-primary-key-differ-from-other-rdbms-databases/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20%3Cstrong%3E3%20Top%20Rules%20to%20Become%20a%20Primary%20Key%20in%20DB2%20Table%3C%2Fstrong%3E&body=https%3A%2F%2Fsrinimf.com%2F2016%2F08%2F04%2Fhow-db2-primary-key-differ-from-other-rdbms-databases%2F&share=email)
-

### Like this:

Like Loading…
