- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2016 05:21 PM
Hi there,
I'm using Helsinki and I'm wondering what is the primary key in a table.
It looks that most of the tables have a column 'sys_id', which seems like the primary key in that table. When I navigate to 'Tables and Columns', I see a big blue circle icon with an 'i' inside beside sys_id:
But some tables don't have sys_id. For example, pa_favorites and v_db_index seem not to have primary keys.
There's another interesting table. ts_word_roots has 3 columns and they are like this:
So my questions are:
1. How can I check what is the primary key in a table? (usually sys_id I guess, but I'm not sure)
2. Are there any tables without primary keys? (like pa_favorites and v_db_index?)
3. For table ts_word_roots, does it have a composite primary key?
Thanks a lot!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2016 05:45 PM
Hi Jerry,
Yes, where there is a sys_id, that's the primary key. I checked some of the others you mentioned and here's what I found.
- pa_favorites - PRI=user
- v_db_index - PRI=sys_id
- ts_word_roots - PRI=index,raw_word,stemmed_word
Let me know if there are any other specifics you need.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 10:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 10:33 AM
That's weird, I really don't see sys_id in that table. Here's the response from mysandbox.service-now.com/v_db_index.do?SCHEMA:
<v_db_index>
<element name="column_names" internal_type="string" max_length="1000" choice_list="false"/>
<element name="table_name" internal_type="table_name" max_length="80" choice_list="false"/>
<element name="index_name" internal_type="string" max_length="80" choice_list="false"/>
</v_db_index>
As you can see, there're only 3 columns show up.
In the picture above, I do see the primary key is sys_id, but it's just invisible. Is it an inaccessible column?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 10:35 AM
Because it starts with v_, it denotes a database view. That makes it special. I don't know the technical underpinnings of how database views work. Suffice it to say, MySQL's desc command isn't lying to me.
Anything else?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 10:40 AM
I see, thanks man.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2016 05:41 PM
Oh how about the table ts_word_roots? It has 3 indexed columns, so does it have a primary key consisting of all the 3 columns? Thanks