Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- a):
- SELECT C.NUMERO
- FROM CAMA C
- INNER JOIN ASIGNADO A ON C.ID = A.CAMA_ID
- WHERE A.PACIENTE_SSN = 123123123 AND ACTIVA = 1;
- -- b):
- SELECT C.NUMERO,
- FROM CAMA C
- INNER JOIN ASIGNADO A ON C.ID = A.CAMA_ID
- INNER JOIN PLANTA P ON C.PLANTA_NUMERO = P.NUMERO
- WHERE A.PACIENTE_SSN = 123123123;
- -- c):
- SELECT TV.ID_TARJETA, TV.ID_DESCRIPCION
- FROM TARJETA_VISITA TV
- INNER JOIN TARJETA_VISTA_PACIENTE TVP ON TV.ID_TARJETA = TVP.TARJETA_VISITA_ID_TARJETA
- WHERE TVP.PACIENTE_SSN = 123123123 ORDER BY TVP.TARJETA_VISITA_ID_TARJETA ASC LIMIT 4;
- -- d):
- SELECT M.NOMBRE
- FROM DIAGNOSTICO D
- INNER JOIN MEDICO M ON D.MEDICO_ID_MEDICO = ID_MEDICO
- INNER JOIN HISTORIAL H ON H.PACIENTE_SSN = D.PACIENTE_SSN
- WHERE D.PACIENTE_SSN = 123123123;
- -- e):
- SELECT P.*
- FROM PACIENTE P
- INNER JOIN DIAGNOSTICO D ON P.PACIENTE_SSN = D.PACIENTE_SSN
- WHERE D.MEDICO_ID_MEDICO = 987987987;
- -- f):
- SELECT TVP.*, C.NUMERO, P.NUMERO,
- FROM CAMA C
- INNER JOIN ASIGNADO A ON C.ID = A.CAMA_ID
- INNER JOIN PLANTA P ON C.PLANTA_NUMERO = P.NUMERO
- INNER JOIN TARJETA_VISTA_PACIENTE TVP ON TVP.PACIENTE_SSN = A.PACIENTE_SSN
- WHERE A.PACIENTE_SSN = 123123123;
- -- g):
- SELECT P.*
- FROM PACIENTE P
- INNER JOIN DIAGNOSTICO D ON P.PACIENTE_SSN = D.PACIENTE_SSN
- WHERE D.TIPO = '«TIPO_DIAGNOSTICO»';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement