53GB

🌊 Consultas avanzadas en MariaDB (Curso de MariaDB desde cero [16])



🌊 Consultas avanzadas en MariaDB (Curso de MariaDB desde cero [16])

Buscar por un campo o por otro o por varios.
select * from tabla where campo1=2 or campo2=3 or campo3=5;

Buscar resultados donde el campo sea diferente a una valor.
select * from tabla where campo!=10 and campo 5;

Buscar resultados diferentes a null.
select * from tabla where campo is not null ;

Buscar resultados cuyo valor estΓ© entre dos valores.
select * from tabla where campo between 7 and 9;

Buscar resultados que estΓ©n dentro de un conjunto de valores.
select * from tabla where campoId in (2,3,4);

Buscar por el resultado de una operaciΓ³n matemΓ‘tica.
select * from tabla where campo=5+5;

Buscar resultados parecidos a un valor.
select * from tabla where campo like β€˜%valor%’;

Codigos:
select * from alumno;
select * from alumno where (idSalon=2 or idSalon=3 or idSalon=5 or idSalon=6) and nota=10;
select * from alumno where nota!=10;
ALTER TABLE alumno CHANGE COLUMN `nota` `nota` INT(11) NULL ;
select * from alumno where nota is not null ;
β€” porque es mejor between
select * from alumno where nota=7 or nota=8 or nota=9;
select * from alumno where nota between 7 and 9;
select * from alumno where nota not between 7 and 9;
select * from alumno where nota not between 7 and 9;
select * from alumno where fecha_ingreso between β€˜2020-01-01’ and β€˜2020-01-01’;
β€” IN
select * from alumno where idSalon in (2,3,4);
select * from salon where grado=2;
select * from alumno where idSalon in (select id from salon where grado=2);
β€” where con operaciones matematicas
select * from alumno where nota=5+5; β€” 5*2
select * from alumno where nombre like β€˜%e%’; β€” termine con e %e comience con j j%
select * from alumno where nombre not like β€˜%e%’; β€” que no tenga letra e

insert into alumnos (idSalon,nombre,fecha_ingreso) values
(6,’Juan’,’2014-01-01β€²),
(6,’Juana’,’2014-01-01β€²),
(6,’Juanito’,’2014-01-01β€²);

πŸ”— Programador Novato: https://www.programadornovato.com/consultas-avanzadas-en-mariadb-curso-de-mariadb-desde-cero-16/

🎦 [CURSO] MYSQL DE 0 A 100🐬: https://www.youtube.com/playlist?list=PLCTD_CpMeEKQmH9cRKWWHahygZFtIdwYG
🎦 [CURSO] PhpMyAdmin En espaΓ±ol πŸ‡ͺπŸ‡Έ: https://www.youtube.com/playlist?list=PLCTD_CpMeEKRDDCpQho7sg1iNYQpOy2G4

πŸ”— Facebook: https://facebook.com/ProgramadorNovatoOficial
πŸ”— Twitter: https://twitter.com/programadornova
πŸ”— Linkedin: https://www.linkedin.com/in/programadornovato/
πŸ”— Instagram: https://www.instagram.com/programadornovato/
πŸ”— Pagina oficial: https://www.programadornovato.com
πŸ”— Gracias por apoyar este canal: https://www.patreon.com/programadornovato
🎦 Canal de youtube: https://www.youtube.com/c/programadornovato
#MariaDB #mysql #Workbench

Exit mobile version