Considere o script abaixo da linguagem SQL para criação das tabelas EMPREGADOR, TRABALHADOR e CONTRATO em um banco de dados relacional para responder a questão:
create table EMPREGADOR
( id int NOT NULL, nome_empregador varchar(200) NOT NULL, cnpj char(14) NOT NULL, telefone varchar(25) NULL PRIMARY KEY (id), UNIQUE (nome_empregador), UNIQUE (cnpj)
);
create table TRABALHADOR
( id int NOT NULL, nome_trabalhador varchar(200) NOT NULL, cpf char(11) NOT NULL, data_nascimento date NULL, sexo_biologico char(1) NOT NULL, PRIMARY KEY (id), UNIQUE (cpf), CHECK ( sexo_biologico in ('M','F') )
);
create table CONTRATO
( id int NOT NULL, id_empregador int NOT NULL, id_trabalhador int NOT NULL, data_inicio datetime NOT NULL, data_fim datetime NULL, PRIMARY KEY (id), UNIQUE (id_empregador, id_trabalhador, data_inicio), FOREIGN KEY (id_empregador) REFERENCES EMPREGADOR (id), FOREIGN KEY (id_trabalhador) REFERENCES TRABALHADOR (id)
);
Escolha a sentença SQL que MELHOR responda à consulta “Listar o nome de todos os empregadores da tabela EMPREGADOR e o total de contratos cadastrados na tabela CONTRATO para cada um. Empregadores sem contratos cadastrados devem aparecer com total igual a zero.”: