# Linked Columns and overloads of $ ! ?

**URL:** <https://forum.kx.com/t/linked-columns-and-overloads-of/13988>\
**Category:** Community Support\
**Tags:** imported, kdb-and-q\
**Created:** [July 15, 2024, 2:06am UTC](https://forum.kx.com/t/linked-columns-and-overloads-of/13988 "2024-07-15T02:06:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![newstudent2017](https://avatars.discourse-cdn.com/v4/letter/n/a5b964/32.png) [@newstudent2017](https://forum.kx.com/u/newstudent2017)\
**Post date:** [July 15, 2024, 2:06am UTC](https://forum.kx.com/t/linked-columns-and-overloads-of/13988/1 "2024-07-15T02:06:29Z")

</div>

[https://learninghub.kx.com/forums/topic/linked-columns-and-overloads-of](https://learninghub.kx.com/forums/topic/linked-columns-and-overloads-of)

I am trying to figure out WHICH overloads of $ ! ? are used in foreign keys and linked columns syntax

Foreign Keys

```
kt$localColumn
```

Question 1. Is $ for enum ?

Question 2. kt as a table type is undocumented (but implied) right ?

LinkedColumn

```
otherTable!otherTable.otherCol?localColumn
```

Q3. Is ? doing a find

Q4. Is ! doing a dict (as in keyed table is a dict too) way OR "linking" which is undocumented still

Q doc still has some gaps which is why I have come up with these inferences after playing around with the code in the links below for a while. So ideally please gives "yes"/"no" or a big tutorial ;-)

Links

https://code.kx.com/q/kb/linking-columns/#splayed-tables

https://code.kx.com/q/wp/foreign-keys/#foreign-keys

---

<div class="post-metadata">

**Author:** ![amcdonald3](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@amcdonald3](https://forum.kx.com/u/amcdonald3)\
**Post date:** [July 15, 2024, 3:20pm UTC](https://forum.kx.com/t/linked-columns-and-overloads-of/13988/2 "2024-07-15T15:20:15Z")

</div>

The following page has some examples on the different types of enum operations: [https://code.kx.com/q/basics/enumerations/](https://code.kx.com/q/basics/enumerations/)

---

<div class="post-metadata">

**Author:** ![amcdonald3](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@amcdonald3](https://forum.kx.com/u/amcdonald3)\
**Post date:** [July 15, 2024, 3:51pm UTC](https://forum.kx.com/t/linked-columns-and-overloads-of/13988/3 "2024-07-15T15:51:01Z")

</div>

Q1. Yes, `$` is creating an enum. [https://code.kx.com/q/ref/enumerate/](https://code.kx.com/q/ref/enumerate/) . Could you supply a reproducible case for what the variables represent in the first statement.

Q2. KeyedTable (kt?) is documented see [https://code.kx.com/q/kb/faq/#keyed-tables](https://code.kx.com/q/kb/faq/#keyed-tables).

Q3. `?` is doing a find. [https://code.kx.com/q/ref/find/](https://code.kx.com/q/ref/find/)

> > > t1

c1 c2

* * *

c 10

b 20

a 30

> > > c3

`sym$`a`b`a`c

> > > t1.c1?c3

2 1 2 0

```

```

Q4. The `!` is simply creating an enumeration. If you are then to update the table with the result of that query, it would be added to the table as a foreign key. Documentation exists here. [https://code.kx.com/q/ref/enumeration/](https://code.kx.com/q/ref/enumeration/)

> > > `t1!t1.c1?c3

`t1!2 1 2 0

> > > update link:`t1!t1.c1?c3 from `t2

`t2

> > > meta t2

c | t f a

----| ------

c3 | s

c4 | f

link| j t1

```

```

The following page has some examples on the different types of enum operations: [https://code.kx.com/q/basics/enumerations/](https://code.kx.com/q/basics/enumerations/)
