What are 0!, 1! and 2!?

When !’s left argument is a positive integer, it sets the key fields of a table:

q)flip `a`b`c ! (1 2 3; 1 2 3; 1 2 3)
a b c
-----
1 1 1
2 2 2
3 3 3
q)1! flip `a`b`c ! (1 2 3; 1 2 3; 1 2 3)
a| b c
-| ---
1| 1 1
2| 2 2
3| 3 3
q)2! flip `a`b`c ! (1 2 3; 1 2 3; 1 2 3)
a b| c
---| -
1 1| 1
2 2| 2
3 3| 3
q)

When !’s left argument is zero, it returns an unkeyed table from a keyed table:

q)0! flip `a`b`c ! (1 2 3; 1 2 3; 1 2 3)
a b c
-----
1 1 1
2 2 2
3 3 3
q)

An arguably more readable equivalent is the xkey function:

q)`a xkey flip `a`b`c ! (1 2 3; 1 2 3; 1 2 3)
a| b c
-| ---
1| 1 1
2| 2 2
3| 3 3
q)`a`b xkey flip `a`b`c ! (1 2 3; 1 2 3; 1 2 3)
a b| c
---| -
1 1| 1
2 2| 2
3 3| 3
q)() xkey flip `a`b`c ! (1 2 3; 1 2 3; 1 2 3)
a b c
-----
1 1 1
2 2 2
3 3 3
q)

It’s easy to confuse function xkey with key, keys, xcol and xcols.