# Database Table Creation

**URL:** <https://forum.inductiveautomation.com/t/database-table-creation/62819>\
**Category:** Ignition\
**Created:** [August 9, 2022, 1:03pm UTC](https://forum.inductiveautomation.com/t/database-table-creation/62819 "2022-08-09T13:03:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason\_kensett](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@jason\_kensett](https://forum.inductiveautomation.com/u/jason_kensett)\
**Post date:** [August 9, 2022, 1:03pm UTC](https://forum.inductiveautomation.com/t/database-table-creation/62819/1 "2022-08-09T13:03:58Z")

</div>

When I make a table following the video there is no primary key or anything extra made. I am assuming this won’t matter unless there is a large amount of data. Parts inventory may be few thousand.  
When do I need to worry about the size of the data?  
Is the size of the table and database thought of all together?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 9, 2022, 2:45pm UTC](https://forum.inductiveautomation.com/t/database-table-creation/62819/2 "2022-08-09T14:45:21Z")

</div>

I always use a primary key, even if it just an auto-incremented integer field. Also, be thinking about whether you will be doing table joins. If so, you’ll probably want to create indexes on fields that would be joined on. Primary keys are unique, so if you have part numbers that are unique, that could be your primary key, which will prevent duplicate entries by accident.

---

<div class="post-metadata">

**Author:** ![jason\_kensett](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@jason\_kensett](https://forum.inductiveautomation.com/u/jason_kensett)\
**Post date:** [August 9, 2022, 3:48pm UTC](https://forum.inductiveautomation.com/t/database-table-creation/62819/3 "2022-08-09T15:48:54Z")

</div>

With us that are trying to crawl in doing this for the first time it would be nice if Ignition would do that for you when a table is made using the query tools. Even the manual uses a pre made table in the database editor instruction that has a key.  
I am thinking easiest way to make a proper table would be to make it in the MS SQL manager.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 9, 2022, 5:02pm UTC](https://forum.inductiveautomation.com/t/database-table-creation/62819/4 "2022-08-09T17:02:55Z")

</div>

> [@jason\_kensett](#):
>
> I am thinking easiest way to make a proper table would be to make it in the MS SQL manager.

Yep, I use MariaDB and manage my table structure with HeidiSQL.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 9, 2022, 5:11pm UTC](https://forum.inductiveautomation.com/t/database-table-creation/62819/5 "2022-08-09T17:11:21Z")

</div>

Following _which_ video? _Which_ query tools?

There’s _lots_ of ways to interact with databases in Ignition.

---

<div class="post-metadata">

**Author:** ![jason\_kensett](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@jason\_kensett](https://forum.inductiveautomation.com/u/jason_kensett)\
**Post date:** [August 9, 2022, 5:56pm UTC](https://forum.inductiveautomation.com/t/database-table-creation/62819/6 "2022-08-09T17:56:46Z")

</div>

The university video:  
[Creating a Table - SQL Basics (inductiveuniversity.com)](https://www.inductiveuniversity.com/videos/creating-a-table/8.1)  
I never found anything in any of the tools relating to making the primary key column. It might be there somewhere but it didn’t jump out at me.  
I started with this to get my head wrapped around it: [Simple Database Editor - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com)](https://docs.inductiveautomation.com/display/DOC81/Simple+Database+Editor)  
In the end I guess if the use of the primary key in a table is an important thing to use or should use then it should be in your face easy.  
Maybe I am overthinking it because I know nothing about the guts of a database. I think that most in my place are looking to be able to keep track of at the most a few thousand items and there info. I first thought that was “big”, but now I think big in this contexts means more like millions and billions.  
Again, I just started poking this issue a few days ago.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 9, 2022, 6:17pm UTC](https://forum.inductiveautomation.com/t/database-table-creation/62819/7 "2022-08-09T18:17:18Z")

</div>

> [@jason\_kensett](#):
>
> I first thought that was “big”, but now I think big in this contexts means more like millions and billions.

We have all been there. 😆

Ignition is great at connecting to and getting information from DB's of many different flavors. It's one of the many attractions of the platform, but it is by no means a Database management system.

You should absolutely get in the habit of setting up tables with proper indexing. Start now and you'll thank yourself for it later. Inevitably, your "few thousand items" will quickly turn into several thousand rows of data.

There are several posts around the forum that deal with DB architecture. Here is one such:

> [@Help with SQL Query to write data from one DB table to another for a monthly report](https://forum.inductiveautomation.com/t/help-with-sql-query-to-write-data-from-one-db-table-to-another-for-a-monthly-report/62075/9):
>
> Real quick crash course: A primary key is key that uniquely identifies a record in a database table. Sort of like a mathematical function (in the strictest definition of a function) where every input maps to exactly one output, and no two inputs will give you the same output. In the most basic form, one that’s widely used, this would be an id column in a table. So this means if you want record 5, you do SELECT \* FROM table WHERE id = 5, and that is the ONLY way you can see record 5 (when onl…

---

<div class="post-metadata">

**Author:** ![jason\_kensett](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@jason\_kensett](https://forum.inductiveautomation.com/u/jason_kensett)\
**Post date:** [August 9, 2022, 6:41pm UTC](https://forum.inductiveautomation.com/t/database-table-creation/62819/8 "2022-08-09T18:41:33Z")

</div>

> [@lrose](#):
>
> We have all been there. 😆
> 
> Ignition is great at connecting to and getting information from DB’s of many different flavors. It’s one of the many attractions of the platform, but it is by no means a Database management system.
> 
> You should absolutely get in the habit of setting up tables with proper indexing. Start now and you’ll thank yourself for it later. Inevitably, your “few thousand items” will quickly turn into several thousand rows of data.
> 
> There are several posts around the forum that deal with DB architecture. Here is one such:

Cool, I will read that when I get a chance. I agree with wanting to start off with good practices as there is always a "later" to deal with it again. In the end the plan is to pass the data up the food chain anyway so I should only have to deal with the mess I make. As such I fully inform those that be of the lack of any warranty with the more than likely chance of having to sacrifice things to the digital god.  
If it's super important they always call the big brains to help.  
Thank again.
