postgresql - How to create a self incremented sequence id for table -
i want table 2 columns id , name
id name 1 peter 2 mary
the functionality needed insert name table , id can created automatically in incremental order
something like
insert table values (jack) id name 1 peter 2 mary 3 jack
i using postgresql 9.3
try this
create table test ( id serial, name text )
since table need 1 column insert
make function
create or replace function insert_into_table(val text) returns void $$ insert test (name) values (val) $$language sql
usage : select insert_into_table('anyname')
Comments
Post a Comment