Advertisement
Jichimon

7 consultas más

Sep 17th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. --21. Mostrar el historial de consultas de 'Sebastian Duran'
  2. select consulta.diagnostico, consulta.motivo, consulta.tratamiento
  3. from consulta, paciente
  4. where paciente.nombre = 'Sebastian Duran' and
  5. paciente.idHist = consulta.idHist
  6.  
  7. --22. Mostrar todas las caras que hay en un diente
  8. select * from cara_dental where idCarDent < 6
  9.  
  10. --23. Mostrar el diagnostico y tratamiento del diente del paciente
  11. select paciente.nombre, diente.nombre, cp_dental.estado_diagnostico, cp_dental.estado_tratamiento
  12. from paciente, diente, cp_dental, odontograma
  13. where paciente.nombre = 'Sebastian Duran'and paciente.idHist = odontograma.idHist and
  14. odontograma.idOdonto = diente.idOdonto and diente.idDiente = cp_dental.idDiente
  15.  
  16. --24. Mostrar la cantidad de usuarios separados por rol
  17. select usuario.idRol, count(usuario.idUsuario) as CantidadDeUsuariosDeEseRol
  18. from usuario
  19. group by usuario.idRol
  20.  
  21. --25. Mostrar cuotas del paciente
  22. select *
  23. from cuota
  24. where cuota.ciPaci in (select ciPaci
  25. from paciente
  26. where paciente.nombre = 'Sebastian Duran');
  27.  
  28. --26. Mostrar historial del paciente
  29. select cita.fecha, consulta.diagnostico, consulta.motivo, consulta.tratamiento
  30. from consulta, paciente, cita
  31. where paciente.nombre = 'Javier Selaya' and paciente.idHist = consulta.idHist
  32. and cita.idHist = paciente.idHist
  33.  
  34. --27. Mostrar odontograma del paciente de la fecha tanto
  35. select paciente.nombre, cita.fecha, diente.nombre, diente.estadoActual, cp_dental.estado_diagnostico, cp_dental.estado_tratamiento
  36. from paciente, diente, odontograma, cp_dental, cita, consulta
  37. where cita.fecha = '2019-09-01' and paciente.nombre = 'Javier Selaya' and
  38. paciente.idHist = cita.idHist and cita.idHist = consulta.idHist and
  39. odontograma.idHist = consulta.idHist and diente.idOdonto = odontograma.idOdonto and
  40. cp_dental.idDiente = diente.idDiente;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement