Diccionario de datos
select numcta
from cuenta
where(tipcta='corriente')
and
(codsuc='2')order by fecape
;.
2. El número de todas las cuentas corrientes del cliente con Id 44444444 y el orden de titularidad.
Select numord, numcta
From
Titular
where numcta in
(selectcuenta.numcta
from cuenta
where
cuenta.tipcta='corriente'
andcuenta.numcta in
(select titular.numcta
from titular
wheretitular.dnicli='44444444'
))
;
3. El número de todas las cuentascorrientes del cliente que se llama Pedro del Valle y el orden de titularidad.
Select distinct numcta
From
Titular
where numcta in
(select cuenta.numcta
from cuenta
wherecuenta.tipcta='corriente'and
cuenta.numcta in
(select titular.numcta
from titular
where
titular.dnicli = (select dniclifrom cliente
where
nomcli='Pedro del Valle'
)
))
;
4. El Id y nombre de todos los clientesque tienen cuenta en la sucursal número 4, ordenado por nombre.
select dnicli, nomcli
from cliente
where dnicli in(
select dnicli
from titular
where
numcta in (
select cuenta.numctafrom cuenta
where
codsuc='4'
)
)
;
* 5. El saldo de la cuenta número 6.
~Select saldo
from cuenta
where numcta='6'
;
~ CREATE VIEW `banco`.`consulta6` AS
select saldo
fromcuenta
where numcta='6'
;
* 6. El número y saldo de todas las cuentas de la sucursal número 4.
~select numcta, saldo
from cuenta
where
codsuc='4'
;
~ CREATE VIEW`banco`.`consulta7` AS
select numcta, saldo
from cuenta
wherecodsuc='4'
;
* 7. Listado de clientes (Id y nombre) con el saldo total ( suma de saldos ) de todas sus cuentas corrientes, ordenado por nombre.select titular.dnicli, cliente.nomcli, titular.numcta,
cuenta.saldo, sum(saldo)
from titular, cliente, cuenta
wheretitular.numcta in
(select numctafrom cuenta
where tipcta='corriente')
and...
Regístrate para leer el documento completo.