# Is there any way I can put the ID attribute incremental in changeset?

**URL:** <https://forum.liquibase.org/t/is-there-any-way-i-can-put-the-id-attribute-incremental-in-changeset/4954>\
**Category:** General Discussion\
**Created:** [January 11, 2021, 2:55pm UTC](https://forum.liquibase.org/t/is-there-any-way-i-can-put-the-id-attribute-incremental-in-changeset/4954 "2021-01-11T14:55:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aynal](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@aynal](https://forum.liquibase.org/u/aynal)\
**Post date:** [January 11, 2021, 2:55pm UTC](https://forum.liquibase.org/t/is-there-any-way-i-can-put-the-id-attribute-incremental-in-changeset/4954/1 "2021-01-11T14:55:37Z")

</div>

Is there any way I can put the ID attribute incremental in changeset  
like

---

<div class="post-metadata">

**Author:** ![rakhi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/rakhi/32/288_2.png) [@rakhi](https://forum.liquibase.org/u/rakhi)\
**Post date:** [January 18, 2021, 11:11am UTC](https://forum.liquibase.org/t/is-there-any-way-i-can-put-the-id-attribute-incremental-in-changeset/4954/2 "2021-01-18T11:11:42Z")

</div>

Hi @aynal,

We can make a column attribute (in your case ID) incremental by creating a sequence (supported in XML schema format for liquibase) for it.

Consider you want to create a table “Employee” and want it to have 2 columns as **ID and Name**. Below XML changeset will create the table Employee with these columns where in column named **ID will be autoincremented** on every insertion to table also the **startValue specifies the initial value** you want for the column to start with (in our case we can keep this as 1)

> ```
> <?xml version="1.0" encoding="UTF-8"?>
> <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
> http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd"> 
> <changeSet author="rakhi" id="create_table_employee" dbms="${dbType}">
> <createSequence sequenceName="emp_id_sequence" incrementBy="1" startValue="1" schemaName="dbSchema"/>
> <createTable tableName="Employee" schemaName="dbSchema">
> <column name="ID" type="INTEGER" defaultValueComputed="nextval('dbSchema.emp_id_sequence')">
> <constraints nullable="false" primaryKey="true" primaryKeyName="emp_id_pkey"/>
> </column>
> <column name="Name" type="VARCHAR(100)">
> <constraints nullable="false"/>
> </column>
> </createTable>
> </changeSet>
> </databaseChangeLog>
> 
> ```

I have tried this and seems to be working for me. Please make sure to replace the correct schema name in the above changeset before giving it a try.

Let me know if this helps!  
Thanks!
