q)n:1000
q)t2:([id:til n] sym:n?`2; price:n?90.)
q)t1:([] `t2$id:til n; sym:n?`2; price:n?90.)q)t3:flip `id`sym`price!"jsf"$\:()
q)t3
id sym price
------------
q)insert[`t3;t1]
q)meta t3
c | t f a
-----| -----
id | j
sym | s
price| f
q)-16!t1 / This is a shallow copy since it has no foreign key relation to t2 (and is not a reference to t1)
1i
q)`:ourTable set t1 / First save t1 down
`:ourTable
q)t4:get `:ourTable / Then get it as t4.
q)meta t4
c | t f a
-----| ------
id | j t2
sym | s
price| f
q)-16!t1
1i / Not a reference to t1
q)meta t1 / Original table with foreign key relation
c | t f a
-----| ------
id | j t2
sym | s
price| f
q)meta -9!-8!t1 / Flying's approach, creating a table without a foreign key relation
c | t f a
-----| -----
id | j
sym | s
price| f See Flying's answer.
--
You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to personal-kdbpl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/personal-kdbplus/8028b2bb-a5dd-4eb6-bb10-553c24299e46%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to personal...@googlegroups.com.