I have the following example, two related tables
Tabela SETOR
SetorID [chave]
Setor
Vagas
Tabela FUNCIONARIOS
FuncionarioID[chave]
SetorID[chave estrangeira]
Nome
Funcao
CargaHoraria
I would like to do a SQL query filtering by Sector ID...
I created a trigger for my X table, for the purpose of making a update record that runs on this table.
For each update in the X table, modified (old) values are stored in the Z table.
PROBLEMATIC :
The X table has several...
I'm trying to use 2 if s but the result always returns empty, when I use only if it will.
SELECT aci_codigo, aci_valor_pagamento, bai_fk_pes_codigo,
aci_tipo_pagamento, aci_fk_ftm_codigo, aci_nosso_numero,
ftm_descr...
I'm trying to make a SELECT in a conta table, in this table I have a foreign key for the venda table, in certain cases this foreign key is null and I want to return the information of the sale when this key i...
I have a following table:
CREATE TABLE tblUser (
id INTEGER PRIMARY KEY AUTOINCREMENT,
uuid VARCHAR(24) NULL,
name VARCHAR(256) NULL
}
I'm inserting a uuid random so that it's a unique identifier directly inside my databa...
I have a table in my database called imoveis where I have some columns in it, highlighting localizacao_fk and correspondencia_fk , both foreign keys that reference the enderecos table. What I want to know is how to ins...
I want to add a foreign key in the CONSULT
However, MySql reports the following error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'REFE...
Can I make a query using 1 case for multiple fields? The fields are of type int .
If not, can I do it in php?
Query
select *,
(case (pergunta1,pergunta2)
when 1 then 'Ótimo'
when 2 then 'Bom'
when 3 then 'Regular'
w...
I'm creating a small project and I'm having a question.
Suppose I have a certain types of coffees, these coffees can be served in more than two cup sizes. Since the relationship between tables is from n to n , we have the following tables:...
I have researched here and google to see if it would solve my problem without having to ask a question, but I could not find any solution.
What I'm trying to do is create a "related" but without it displaying the same post or video in case. I...