Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
viernes_ alumnos
create table alumnos( expediente int not null primary key, nombre varchar(50), localidad varchar(50), fecha_nac date, direccion varchar(50), curso int, nivel varchar(10), faltas int ) insert into alumnos values(123456,'Juan Miguel Soler Bakero','Murcia','1995-10-10','Gran Vía, 2, 4A',1,'ESO',15); insert into alumnos values(654321,'Laura Gómez Fernández','Lorca','1994-05-10','Junterones, 10, 5B',2,'ESO',25); insert into alumnos values(765432,'Beatriz Martínez Hernández','Murcia','1993-05-05','Plaza Mayor, 6, 3B',3,'ESO',5); insert into alumnos values(987654,'Diego Martín Llorente','Alhama de Murcia','1990-06-03','Diego de la Cierva, 5, 7A',1,'BACHILLER',34); insert into alumnos values(445544,'Juan Francisco Cano Riquelme','Murcia','1992-07-01','Plaza de Belluga, 3, 4A',4,'ESO',13); insert into alumnos values(223322,'Raquel Riquelme Rubio','Lorca','1990-11-23','San Juan, 14, 3B',1,'BACHILLER',7); insert into alumnos values(9988877,'Cristina Sánchez Bermejo','Murcia','1995-03-19','Torre de Romo, 7',1,'ESO',1); insert into alumnos values(334455,'Pedro Jesús Rodríguez Soler','Alhama de Murcia','1994-03-10','Camino de Badel, 4',2,'ESO',11); insert into alumnos values(334400,'Javier Ramánez Rodríguez','Murcia','1993-05-27','Gran Vía, 4, 3A',3,'ESO',NULL); insert into alumnos values(993322,'Gema Rubio Colero','Lorca','1992-09-09','Plaza Fuensanta, 5, 7A',1,'BACHILLER',19); insert into alumnos values(554411,'Joaquín Hernández González','Lorca','1991-12-12','Junterones, 4, 5A',2,'BACHILLER',14); --select * from alumnos --select nombre, localidad, fecha_nac from alumnos --select nombre, localidad as 'Nombre y apellido' from alumnos --select nombre, (faltas*2) as 'Faltas de asistencia' from alumnos --select nombre, faltas from alumnos --select * from alumnos where Localidad='LORCA' --Select * from alumnos where Localidad='MURCIA' OR Localidad='Alhama de Murcia' --Select * from alumnos where Localidad='MURCIA' and curso=1 and nivel='ESO' --select * from alumnos where curso in (1,2) and faltas>10 --select * from alumnos where localidad='MURCIA' AND curso in (3,4) and faltas<10 --select distinct curso from alumnos --select * from alumnos where curso=1 and faltas<10 and nivel='ESO' --select * from alumnos where nombre like 'b%' --select * from alumnos where nombre like '%o' and localidad='MURCIA' --select * from alumnos where nombre like '%_u%' and curso=1 and nivel='ESO' --SELECT * FROM ALUMNOS WHERE FALTAS IS NULL --SELECT * from alumnos where faltas between 10 and 20 order by nombre --SELECT * from alumnos where localidad='MURCIA' AND faltas between 10 and 20 --SELECT * FROM ALUMNOS WHERE localidad='MURCIA' AND curso=1 and nivel='ESO' and faltas between 10 and 20 --select * from alumnos where faltas<10 or faltas >20 --select * from alumnos where fecha_nac between '1993' and '1994' order by nombre --select * from alumnos where curso=1 and nivel in ('ESO', 'BACHILLER') --SELECT* FROM ALUMNOS WHERE LOCALIDAD='MURCIA' AND CURSO IN (3,4) --------SELECT * FROM ALUMNOS WHERE NIVEL<>'ESO' ORDER BY NOMBRE, CURSO ASC --SELECT * FROM ALUMNOS WHERE NIVEL<>'BACHILER' AND CURSO NOT IN ( 1,2 ) --SELECT * FROM ALUMNOS WHERE NOMBRE LIKE 'J%' AND NIVEL<>'BACHILLER' AND FALTAS>10 --SELECT expediente, nombre, curso, nivel FROM alumnos WHERE nivel <> 'Bachiller' ORDER BY curso, nivel, nombre DESC --select upper(nombre) as 'nombre mayuscula' from alumnos where localidad='murcia' --select upper(nombre) as 'NOMBRE EN MAYUSCULA', lower(localidad) as 'localidad en minuscula' from alumnos order by localidad --SELECT nombre +'----'+ localidad as 'concatenacion', replace ('BACHILLER','BACHILLER','Bachillerato') AS NIVEL from alumnos --SELECT NOMBRE,LEN (NOMBRE) AS 'LONGITUD NOMBRE' FROM ALUMNOS --SELECT nombre, YEAR (fecha_nac) AS 'AÑO DE NACIMIENTO', MONTH (fecha_nac) AS 'MES DE NACIMIENTO' from alumnos --SELECT nombre, datediff (year, fecha_nac, getdate()) as 'edad del alumno' from alumnos order by 'edad del alumno' asc
run
|
edit
|
history
|
help
0
sql test
Demo
TSQL - Unique string generator
Arif First Query
Find users who have been watching kid's programmes for 13 weeks
Common Table Expression
testing
MERGE with OUTPUT
ex2
bc160401882