I'm doing a SQL / Modeling course in mysql the creation of a composite table would look like this:
USE banco;
CREATE TABLE clientes(
cli_id integer not null auto_increment,
cli_nome varchar(20) not null,
cli_email varchar(30) not null
primary key (cli_id)
); /*Cria a tabela no mysql*/
OK, now in firebird I have to do:
CREATE TABLE clientes(
cli_id integer not null auto_increment,
cli_nome varchar(20) not null,
cli_email varchar(30) not null
primary key (cli_id)
); /*cria a tabela no firebird*/
create generator gen_cidades_id /*Cria gerador auto increment*/
SET TERM ^
CREATE TRIGGER TR_CIDADES FOR CIDADES
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
new.CID_CODIGO =gen_id(ge_cidades_id, 1);
END ^
Is there no other way to do auto_increment, in firebird beyond that? because this part here:
create generator gen_cidades_id /*Cria gerador auto increment*/
SET TERM ^
CREATE TRIGGER TR_CIDADES FOR CIDADES
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
new.CID_CODIGO =gen_id(ge_cidades_id, 1);
END ^
I do not understand it and it's very complicated, as I see it.