
'b9a35303-a8d9-4897-a674-fd951187da71'


'b9a35303-a8d9-4897-a674-fd951187da71'

select * from pessoas where empresa_id in ('b9a35303-a8d9-4897-a674-fd951187da71')

select * from empresas where id in ('b9a35303-a8d9-4897-a674-fd951187da71')



delete from titulos where empresa_id in ('b9a35303-a8d9-4897-a674-fd951187da71');
delete from cursos where empresa_id in ('b9a35303-a8d9-4897-a674-fd951187da71');
delete from formas_pagamento where empresa_id in ('b9a35303-a8d9-4897-a674-fd951187da71');
delete from contas_bancarias where empresa_id in ('b9a35303-a8d9-4897-a674-fd951187da71');
delete from tipos_cobranca where empresa_id in ('b9a35303-a8d9-4897-a674-fd951187da71');
delete from materiais where empresa_id in ('b9a35303-a8d9-4897-a674-fd951187da71');					
delete from salas where empresa_id in ('b9a35303-a8d9-4897-a674-fd951187da71');
delete from quesitos where empresa_id in ('b9a35303-a8d9-4897-a674-fd951187da71');
delete from pessoas where empresa_id in ('b9a35303-a8d9-4897-a674-fd951187da71');
delete from fechamentos_conta where empresa_id in ('b9a35303-a8d9-4897-a674-fd951187da71');
delete from idiomas where empresa_id in ('b9a35303-a8d9-4897-a674-fd951187da71');
delete from empresas where id in ('b9a35303-a8d9-4897-a674-fd951187da71');














update titulos set situacao = 'C', data_cancelamento = '2019-04-24' where empresa_id = 'a87ff679-a2f3-e71d-9181-a67b7542122c' and tipo = 'R' and titulos.forma_pagamento_id = '9bf31c7f-f062-936a-96d3-c8bd1f8f2ff3' and situacao = 'A'
and data_vencimento >= '2019-05-01' 



--todas as aulas de um curso que não tem um aluno
SELECT * FROM `aulas`
WHERE aulas.curso_id = '971bd5e6-6bec-487f-a4a9-17a4da048b68' 
and (select count(*) from aula_alunos where aula_alunos.aula_id = aulas.id and aula_alunos.pessoa_aluno_id = 'f3293313-f254-41b0-80c2-40715381902f') = 0
and aulas.data >= '2019-04-17'


insert into aula_alunos (id, created_at, updated_at, aula_id, pessoa_aluno_id, presente)
SELECT (SELECT UUID()), '2019-10-05 00:00:00',  '2019-10-05 00:00:00', aulas.id, '7ff09742-1f48-4523-b12c-f439c061b55f', 1 FROM `aulas`
WHERE aulas.curso_id = '971bd5e6-6bec-487f-a4a9-17a4da048b68' 
and (select count(*) from aula_alunos where aula_alunos.aula_id = aulas.id and aula_alunos.pessoa_aluno_id = '7ff09742-1f48-4523-b12c-f439c061b55f') = 0
and aulas.data >= '2019-09-25'


SELECT (SELECT UUID()), '2019-07-03 00:00:00',  '2019-07-03 00:00:00', 'aaa','aluno',1 FROM `aula_alunos`