Forum: Building VoltDB Applications

Post: add an additional column (fullname) that combines the values of the two

add an additional column (fullname) that combines the values of the two
BlitzDog
Jul 9, 2012
from the user manual:
"... There is only one partition column per table. If you need to partition a table on two columns (for
example first and last name), add an additional column (fullname) that combines the values of the two
columns and use this new column to partition the table..."
Could someone give me a hint as to how this might be achieved?
An example
ajgent
Jul 12, 2012
For example. using the the quote you gave, the schema might look like this:

CREATE TABLE Employee { first_name VARCHAR(64), last_name VARCHAR(64), full_name VARCHAR(64), PRIMARY KEY(fullname) }; The column full_name is declared as the partitioning column in the project file:

<partitions> <partition table='Employee' column='full_name' /> </partitions> Then, using the automatically generated stored procedures, you would insert a record like so:

client.callProcedure("EMPLOYEE.insert",firstName,lastName,lastName + " " + firstName); The point to note here is that it is up to the client app to construct the concatenated partitioning column value.
Hope that helps,
--Andrew