SlideShare a Scribd company logo
1 of 5
use hospital
create table paciente
(numdesesocial nvarchar (15),
nomdepaciente nvarchar(15),
apellidopaciente nvarchar(30),
domicilio nvarchar(30),
ciudad nvarchar(25),
provincia nvarchar(15),
telefono nvarchar(15),
numerohistorial nvarchar (9) primary key,
fechanacimiento date,
sexo nvarchar (1),
cedula nvarchar (15),
)
select * from paciente
create table ingresos
(
numingreso int primary key ,
numerohistorial nvarchar(9),
fechaingreso date,
codigodeidentifi nvarchar(4),
numdeplanta nvarchar(2),
numdecama nvarchar(4),
alergico nvarchar(4),
observaciones nvarchar (200),
costodetratamiento decimal(18,2),
diagnostico nvarchar (40),
)
select * from ingresos
create table medicos
(
id nvarchar (4)primary key,
nomdemedico nvarchar(15),
apellidomedico nvarchar(30),
especialidad nvarchar(25),
fechadeingreso date,
cargo nvarchar(25),
numerodeidonei int,
observaciones nvarchar (200),
)
select * from medicos
select * from paciente
insert into paciente values ('1884416a','juan','arauz','la
arena','chitre','herrera','9964578','10206-f','1977/03/24','m','685965')
insert into paciente values ('1432508a','maria','serrano','san
cristobal','david','chiriqui','7774123','12541-h','1985/06/29','f','4552785')
insert into paciente values ('2578521h','pedro','castillo','divino
niño','santiago','veraguas','9985521','10452-f','1963/09/14','m','974552')
insert into paciente values ('2663255a','jacob','sanchez','el
alba','david','chiriqui','7774125','10552-m','1952/11/18','m','5741522')
insert into paciente values ('1178545a','katherine','gonzalez','las tablas','changinola','bocas
del toro','7589621','12542-h','1988/05/14','f','16321125')
insert into paciente values ('1345854h','tilsa','gutierrez','las
moras','david','chiriqui','7749654','55212-j','1922/01/16','f','4563552')
insert into paciente values
('6985412m','diomedes','sanchez','pocri','aguadulce','cocle','9965212','45785-
h','1985/03/22','m','2551745')
insert into paciente values ('6522785a','efrain','justavino','el
rocio','david','chiriqui','7741233','45223-l','1972/02/11','m','47211102')
insert into paciente values ('1496321a','jorge','nuñez','la
pradera','aguadulce','cocle','9960045','45512-h','1985/07/06','m','21241052')
insert into paciente values ('7854214a','estefani','carranza','el
cabrero','david','chiriqui','7746321','54521-h','1993/12/11','f','4752223')
insert into paciente values ('9952142h','carla','montenegro','las
lomas','david','chiriqui','7778922','85471-h','1988/08/18','f','49641254')
insert into paciente values ('1874523a','horacio','martinez','casa
hacienda','david','chiriqui','7589633','54123-h','1975/07/03','m','4412223')
insert into paciente values
('4452132a','ricardo','aviles','forestal','santiago','veraguas','9986632','44112-
h','1962/06/19','m','95221022')
select * from ingresos
insert into ingresos values (1,'10206-f','2013/05/12','asd','5','521','si','alergico a
penicilina',5232.00,'cataratas')
insert into ingresos values (2,'12541-
h','2013/05/13','kkd','2','211','','epilepsia',500.00,'calculos')
insert into ingresos values (3,'10452-f','2013/06/18','iuw','1','125','','',8965.00,'')
insert into ingresos values (4,'10552-
m','2013/06/18','ldm','5','512','','',7412.00,'descalcificacion')
insert into ingresos values (5,'12542-h','2013/06/19','sff','4','455','','',921.00,'')
insert into ingresos values (6,'55212-j','2013/06/20','sff','4','485','si','alergico a
anestesia',1521.00,'apendicitis')
insert into ingresos values (7,'45785-h','2013/08/15','ldm','5','500','','',2458.00,'')
insert into ingresos values (8,'45223-l','2013/08/16','kkd','5','532','','',125.32,'artritis')
insert into ingresos values (9,'45512-h','2013/08/21','ois','4','412','','lleva
marcapaso',8745.00,'')
insert into ingresos values (10,'54521-h','2013/08/21','lsa','2','299','','',963.11,'')
insert into ingresos values (11,'85471-h','2013/08/21','iuw','1','144','','',114.11,'')
insert into ingresos values (12,'54123-h','2013/08/22','ois','1','155','','propenso a
fractura',1634.00,'fractura craneal')
insert into ingresos values (13,'44112-h','2013/08/23','asd','3','374','','',474.93,'')
select * from medicos
insert into medicos values ('ajh','antonio','jimenez
hernandez','pediatria','1990/08/12','adjunto',1213,'esta proximo a jubilare')
insert into medicos values ('cem','carmen','muñoz','psiquiatria','1992/10/30','jefe de
planta',2396,'')
insert into medicos values ('csm','carlos','sanchez martinez','medicina
general','1990/01/14','supervisor',2020,'se le deben 2 salarios')
insert into medicos values ('esmh','eva',' hernandez
santamaria','radiologia','1990/02/10','jefe de planta',3020,'realiza muchas horas extras')
insert into medicos values ('fhl','fernanda',' lopez revilla','analisis','2002/03/23','jefe de
seccion',5660,' proximo ascenso')
insert into medicos values ('fvp','federico',' padilla garcia','intensivos','1991/05/20','jefe de
seccion',35811,'')
insert into medicos values ('jmn','juana','moreno
navarro','intensivos','1991/08/05','adjunto',2453,'')
insert into medicos values ('opa','olga',' ponce
alvarez','cirugia','1991/05/12','ayudante',2111,'')
insert into medicos values ('pap','pedro',' prax
villareal','ginecologia','1991/10/10','adjunto',9290,'')
insert into medicos values ('sgm','sebastian','gutierrez
moreno','oftalmologia','1993/02/28','supervisor',1010,'suele llegar tarde')
insert into medicos values ('svt','santiago','vasquez
yanguez','cirugia','1991/04/12','ayudante',3566,'')
select * from paciente
select * from ingresos
select * from medicos
select nomdepaciente,apellidopaciente,numdesesocial,telefono,numerohistorial from
paciente
where (provincia='chiriqui')
order by nomdepaciente asc
select nomdemedico,apellidomedico,especialidad,fechadeingreso,cargo from medicos
where (numerodeidonei>=2000)
order by apellidomedico asc
select* from paciente
inner join ingresos on paciente.numerohistorial=ingresos.numerohistorial
order by nomdepaciente asc

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Parcial2

  • 1. use hospital create table paciente (numdesesocial nvarchar (15), nomdepaciente nvarchar(15), apellidopaciente nvarchar(30), domicilio nvarchar(30), ciudad nvarchar(25), provincia nvarchar(15), telefono nvarchar(15), numerohistorial nvarchar (9) primary key, fechanacimiento date, sexo nvarchar (1), cedula nvarchar (15), ) select * from paciente create table ingresos ( numingreso int primary key , numerohistorial nvarchar(9), fechaingreso date, codigodeidentifi nvarchar(4), numdeplanta nvarchar(2), numdecama nvarchar(4), alergico nvarchar(4), observaciones nvarchar (200), costodetratamiento decimal(18,2),
  • 2. diagnostico nvarchar (40), ) select * from ingresos create table medicos ( id nvarchar (4)primary key, nomdemedico nvarchar(15), apellidomedico nvarchar(30), especialidad nvarchar(25), fechadeingreso date, cargo nvarchar(25), numerodeidonei int, observaciones nvarchar (200), ) select * from medicos select * from paciente insert into paciente values ('1884416a','juan','arauz','la arena','chitre','herrera','9964578','10206-f','1977/03/24','m','685965') insert into paciente values ('1432508a','maria','serrano','san cristobal','david','chiriqui','7774123','12541-h','1985/06/29','f','4552785') insert into paciente values ('2578521h','pedro','castillo','divino niño','santiago','veraguas','9985521','10452-f','1963/09/14','m','974552') insert into paciente values ('2663255a','jacob','sanchez','el alba','david','chiriqui','7774125','10552-m','1952/11/18','m','5741522') insert into paciente values ('1178545a','katherine','gonzalez','las tablas','changinola','bocas del toro','7589621','12542-h','1988/05/14','f','16321125')
  • 3. insert into paciente values ('1345854h','tilsa','gutierrez','las moras','david','chiriqui','7749654','55212-j','1922/01/16','f','4563552') insert into paciente values ('6985412m','diomedes','sanchez','pocri','aguadulce','cocle','9965212','45785- h','1985/03/22','m','2551745') insert into paciente values ('6522785a','efrain','justavino','el rocio','david','chiriqui','7741233','45223-l','1972/02/11','m','47211102') insert into paciente values ('1496321a','jorge','nuñez','la pradera','aguadulce','cocle','9960045','45512-h','1985/07/06','m','21241052') insert into paciente values ('7854214a','estefani','carranza','el cabrero','david','chiriqui','7746321','54521-h','1993/12/11','f','4752223') insert into paciente values ('9952142h','carla','montenegro','las lomas','david','chiriqui','7778922','85471-h','1988/08/18','f','49641254') insert into paciente values ('1874523a','horacio','martinez','casa hacienda','david','chiriqui','7589633','54123-h','1975/07/03','m','4412223') insert into paciente values ('4452132a','ricardo','aviles','forestal','santiago','veraguas','9986632','44112- h','1962/06/19','m','95221022') select * from ingresos insert into ingresos values (1,'10206-f','2013/05/12','asd','5','521','si','alergico a penicilina',5232.00,'cataratas') insert into ingresos values (2,'12541- h','2013/05/13','kkd','2','211','','epilepsia',500.00,'calculos') insert into ingresos values (3,'10452-f','2013/06/18','iuw','1','125','','',8965.00,'') insert into ingresos values (4,'10552- m','2013/06/18','ldm','5','512','','',7412.00,'descalcificacion') insert into ingresos values (5,'12542-h','2013/06/19','sff','4','455','','',921.00,'') insert into ingresos values (6,'55212-j','2013/06/20','sff','4','485','si','alergico a anestesia',1521.00,'apendicitis') insert into ingresos values (7,'45785-h','2013/08/15','ldm','5','500','','',2458.00,'') insert into ingresos values (8,'45223-l','2013/08/16','kkd','5','532','','',125.32,'artritis') insert into ingresos values (9,'45512-h','2013/08/21','ois','4','412','','lleva marcapaso',8745.00,'') insert into ingresos values (10,'54521-h','2013/08/21','lsa','2','299','','',963.11,'')
  • 4. insert into ingresos values (11,'85471-h','2013/08/21','iuw','1','144','','',114.11,'') insert into ingresos values (12,'54123-h','2013/08/22','ois','1','155','','propenso a fractura',1634.00,'fractura craneal') insert into ingresos values (13,'44112-h','2013/08/23','asd','3','374','','',474.93,'') select * from medicos insert into medicos values ('ajh','antonio','jimenez hernandez','pediatria','1990/08/12','adjunto',1213,'esta proximo a jubilare') insert into medicos values ('cem','carmen','muñoz','psiquiatria','1992/10/30','jefe de planta',2396,'') insert into medicos values ('csm','carlos','sanchez martinez','medicina general','1990/01/14','supervisor',2020,'se le deben 2 salarios') insert into medicos values ('esmh','eva',' hernandez santamaria','radiologia','1990/02/10','jefe de planta',3020,'realiza muchas horas extras') insert into medicos values ('fhl','fernanda',' lopez revilla','analisis','2002/03/23','jefe de seccion',5660,' proximo ascenso') insert into medicos values ('fvp','federico',' padilla garcia','intensivos','1991/05/20','jefe de seccion',35811,'') insert into medicos values ('jmn','juana','moreno navarro','intensivos','1991/08/05','adjunto',2453,'') insert into medicos values ('opa','olga',' ponce alvarez','cirugia','1991/05/12','ayudante',2111,'') insert into medicos values ('pap','pedro',' prax villareal','ginecologia','1991/10/10','adjunto',9290,'') insert into medicos values ('sgm','sebastian','gutierrez moreno','oftalmologia','1993/02/28','supervisor',1010,'suele llegar tarde') insert into medicos values ('svt','santiago','vasquez yanguez','cirugia','1991/04/12','ayudante',3566,'') select * from paciente select * from ingresos select * from medicos
  • 5. select nomdepaciente,apellidopaciente,numdesesocial,telefono,numerohistorial from paciente where (provincia='chiriqui') order by nomdepaciente asc select nomdemedico,apellidomedico,especialidad,fechadeingreso,cargo from medicos where (numerodeidonei>=2000) order by apellidomedico asc select* from paciente inner join ingresos on paciente.numerohistorial=ingresos.numerohistorial order by nomdepaciente asc