Skip to content

Instantly share code, notes, and snippets.

@mhdelta
Last active April 16, 2018 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhdelta/7a44bc578435cf81cc892b80cc4e06f7 to your computer and use it in GitHub Desktop.
Save mhdelta/7a44bc578435cf81cc892b80cc4e06f7 to your computer and use it in GitHub Desktop.
bd consultas
Miguel Ángel Henao Pérez
1.
SELECT idfab, idproducto, descripcion, precio, (precio * 1.19) as 'precio con iva' FROM `productos` WHERE 1
2.
SELECT NUMPEDIDO, fab, producto, CANT, (IMPORTE / cant) AS "precio unitario" FROM `pedidos` WHERE 1
3.
SELECT NOMBRE, CONTRATO, DATEDIFF(NOW(), CONTRATO) as Dias_trabajados, edad, (year(now())- edad), as año_nacimiento FROM empleados
4.
SELECT * FROM cleintes order by REPCLIE
5.
SELECT * FROM oficinas order by REGION, ciudad, oficina, DESC
6.
SELECT * FROM pedidos ORDER BY FECHAPEDIDO
7.
SELECT * FROM PEDIDOS ORDER BY PEDIDOS, IMPORTE DESC LIMIT 4
8.
SELECT NUMPEDIDO, FAB, PRODUCTO, CANT, (IMPORTE/CANT), as PRECIO_UNITARIO, IMPORTE FROM pedido, order by PRECIO_UNITARIO asc limit 5
9.
SELECT * FROM pedidos WHERE MOTH(FECHAPEDIDO)=3
10.
SELECT numemp FROM empleados WHERE oficina IS NOT NULL
11.
SELECT oficina FROM oficinas WHERE DIR IS NULL
12.
SELECT * FROM oficinas WHERE (REGION = NORTE) OR (REGION = ESTE)
13.
SELECT * FROM empleados WHERE nombre LIKE julia
14.
SELECT * FROM productos WHERE idproducto LIKE "%X"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment