Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
jueves(08)
create table personas( cod_hospital int, dni integer primary key, apellidos varchar(50), funcion varchar(30), salario int, localidad varchar(20) ) insert into personas values (1,12345678,'García Hernández, Eladio','CONSERJE',1200,'LORCA'); insert into personas values (1,87654321,'Fuentes Bermejo, Carlos','DIRECTOR',2000,'MURCIA'); insert into personas values (2,55544433,'González Marín, Alicia','CONSERJE',1200,'MURCIA'); insert into personas values (1,66655544,'Castillo Montes, Pedro','MEDICO',1700,'MURCIA'); insert into personas values (2,22233322,'Tristán García, Ana','MEDICO',1900,'MURCIA'); insert into personas values (3,55544411,'Ruiz Hernández, Caridad','MEDICO',1900,'LORCA'); insert into personas values (3,99988333,'Serrano Díaz, Alejandro','DIRECTOR',2400,'CARTAGENA'); insert into personas values (4,33222111,'Mesa del Castillo, Juan','MEDICO',2200,'LORCA'); insert into personas values (2,22233333,'Martínez Molina, Andrés','MEDICO',1600,'CARTAGENA'); insert into personas values (4,55544412,'Jiménez Jiménez, Dolores','CONSERJE',1200,'MURCIA'); insert into personas values (4,22233311,'Martínez Molina, Gloria','MEDICO',1600,'MURCIA'); --select* FROM PERSONAS --SELECT dni, apellidos, funcion from personas --select apellidos, localidad from personas where localidad='LORCA' --select apellidos, localidad from personas where localidad='LORCA' or localidad='MURCIA' order by localidad asc --select * from personas where salario>1500 AND localidad='MURCIA' --SELECT * FROM personas where funcion='DIRECTOR' AND salario>1500 and localidad='MURCIA' --SELECT * FROM PERSONAS WHERE FUNCION='MEDICO' --SELECT * FROM PERSONAS WHERE SALARIO>1500 AND FUNCION='MEDICO' ORDER BY SALARIO ASC --SELECT * FROM PERSONAS WHERE APELLIDOS LIKE 'M%' --SELECT * FROM PERSONAS WHERE APELLIDOS LIKE '%M%'AND FUNCION='CONSERJE' --SELECT * FROM PERSONAS WHERE SALARIO BETWEEN 1500 AND 2000 --SELECT * FROM PERSONAS WHERE FUNCION IN ('MEDICO', 'DIRECTOR') --SELECT * FROM PERSONAS WHERE FUNCION NOT IN ('CONSERJE') AND SALARIO>1500 ORDER BY APELLIDOS ASC --SELECT * FROM PERSONAS WHERE SALARIO>1500 AND FUNCION NOT IN ('CONSERJE') ORDER BY APELLIDOS ASC --SELECT * FROM PERSONAS WHERE cod_hospital=1 AND LOCALIDAD IN ('MURCIA', 'CARTAGENA') --SELECT UPPER (APELLIDOS) FROM PERSONAS WHERE cod_hospital=1 --SELECT cod_hospital, LOWER (APELLIDOS) FROM PERSONAS WHERE cod_hospital=1 --select apellidos, len (apellidos) as 'longitud apellido' from personas --select cod_hospital, lower(apellidos), lower (localidad) from personas where cod_hospital<>1 --select * from personas where salario>1500 and cod_hospital=1 or cod_hospital=2 --select * FROM PERSONAS where cod_hospital NOT IN (2) AND LOCALIDAD='MURCIA'
run
|
edit
|
history
|
help
0
elie homsi's code
Co-Related sub query
range and pattern matching
While Loop in SQL Server for Multiple Entries
Exp8Q2
SQL flight 2
generate-data-combinations-for-a-column-dynamically-based-on-another-column-sql
SCHOOL-BUILD
Test
EmployeeDetails