---
title: "Why SQLite not allow in same table on different rows if we use '0' and '0.' as a primary key"  
description: "Why SQLite not allow in same table on different rows if we use '0' and '0.' as a primary key"  
author: "Tarun Kumar"  
published: 2015-09-30  
updated: 2020-09-22  
canonical: https://www.mindstick.com/interview/22848/why-sqlite-not-allow-in-same-table-on-different-rows-if-we-use-0-and-0-as-a-primary-key  
category: "sqlite"  
tags: ["database", "sqlite", "sqlite3"]  
reading_time: 1 minute  

---

# Why SQLite not allow in same table on different rows if we use '0' and '0.' as a primary key

When primary key is numeric type then the problem is occurs, if we use TEXT as a datatype with primary key then it will execute successfully. All the rows having unique primary key. For a column with a numeric type, SQLite thinks that '0' and '0.0' are the same values because they compare it equal to one another numerically. so the value will not be unique.

## Answers

### Answer by Tarun Kumar

When primary key is numeric type then the problem is occurs, if we use TEXT as a datatype with primary key then it will execute successfully. All the rows having unique primary key. For a column with a numeric type, SQLite thinks that '0' and '0.0' are the same values because they compare it equal to one another numerically. so the value will not be unique.


---

Original Source: https://www.mindstick.com/interview/22848/why-sqlite-not-allow-in-same-table-on-different-rows-if-we-use-0-and-0-as-a-primary-key

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
