> I'm new to MySQL coming from PostgreSQL backgroud. I'd like to know how to
> obtain the same effect of a sequence + concat as default value of a table
> mysql. For example, consider the following table definition:
> CREATE TABLE competenza
> id_competenza character varying(30) NOT NULL DEFAULT ('comp-06-'::text
> descrizione character varying(100),
> CONSTRAINT competenza_pkey PRIMARY KEY (id_competenza)
> there, id_competenza is compound by a string "comp-06" and the next value
> sequence (similar to auto_increment). In MySQL there're no sequences, or
> better, there's only an auto_increment action on an int field. How can I
> obtain the same effect of the concatenation of a sequence and a string?
Hmm, well, I think: not at all.
Unless you implement something like sequences yourself.
MySQL doesn't allow functions to be used in the DEFAULT clause either.
Database Workbench - development tool for MySQL, and more!
Database development questions? Check the forum!