我的问题是:
查找由contract_m.salar_baza+contract_j.onorar*contract_m.comision/100
组成的总薪水
并且final
结果包含名称和total_salary
。
tables
的结构是:
contract_m:
id_cm
comision
id_angajat
- 具有相同的值persoana.id_p
salar_baza
contract_j:
id_cj
onorar
id_avocat
- 具有相同的值persoana.id_p
Persoana
id_p
name
答案 0 :(得分:0)
select persoana.nume, (select contract_m.salar_baza from contract_m inner join persoana
on contract_m.id_angajat=persoana.id_p)+ (select contract_m.comision*contract_j.onorar from contract_m inner join contract_j on contract_m.id_angajat=contract_j.id_avocat) from persoana
我的表格格式是
CREATE TABLE "CONTRACT_J"
( "ID_CJ" NUMBER,
"DATA" DATE,
"OBIECT" VARCHAR2(12),
"ONORAR" NUMBER,
"EXEMPLARE" NUMBER,
"ID_CLIENT" NUMBER,
"ID_AVOCAT" NUMBER,
CONSTRAINT "CONTRACT_J_CON" PRIMARY KEY ("ID_CJ")
USING INDEX ENABLE
)
/
CREATE TABLE "CONTRACT_M"
( "ID_CM" NUMBER,
"DATA" DATE,
"FUNCTIE" VARCHAR2(12),
"SALAR_BAZA" NUMBER,
"COMISION" NUMBER,
"ID_ANGAJAT" NUMBER
)
/
CREATE TABLE "PERSOANA"
( "ID_P" NUMBER,
"NUME" VARCHAR2(40),
"ADRESA" VARCHAR2(12),
"TELEFON" NUMBER,
CONSTRAINT "PERSOANA_CON" PRIMARY KEY ("ID_P")
USING INDEX ENABLE
)
/