# Literals in Power Query (M language)

## Table

Tables are considered the same if for each column in one table there is equivalent column in another table. Order of columns is not important.

``````#table({"A","B"},{{1,2}}) = #table({"A","B"},{{1,2}}) // true
#table({"A","B"},{{1,2}}) = #table({"X","Y"},{{1,2}}) // false
#table({"A","B"},{{1,2}}) = #table({"B","A"},{{2,1}}) // true``````

## Record

Records are equal if for each field in one record ther is an equal field in another record. Order of fields is not important.

``````[ A = 1, B = 2 ] = [ A = 1, B = 2 ]        // true
[ B = 2, A = 1 ] = [ A = 1, B = 2 ]        // true``````

We can make a union of several records. If we have one field in more than one record, then the value from the last record with that field will be the final one. In our example x will be assigned the value 3, and not the value 1.

``[ x = 1, y = 2 ] & [ x = 3, z = 4 ]  // [ x = 3, y = 2, z = 4 ] ``

## List

Two lists are equal if the have the same elements and position of those elements is the same.

``````{1, 2} = {1, 2} // true
{2, 1} = {1, 2} // false``````

We can concatenate several lists with & operators.

``{1, 4} & {2, 3} // list concatenation: {1, 4, 2, 3} ``

## Special Signs

If we want to type two characters “#(“, we have to write them like “#(#)(“, because those characters has to be escaped. Two signs “#(cr)#(lf)”, when consecutive, can be typed as “#(cr,lf)”, the result would be the same.

## Date and time

Date and time can be expressed with these literals.

``````#time(hour, minute, second)
#date(year, month, day)
#datetime(year, month, day, hour, minute, second)
#datetimezone( year, month, day, hour, minute, second, offset-hours, offset-minutes)
#duration(days as number, hours as number, minutes as number, seconds as number)``````