Your SlideShare is downloading. ×
Gbd10
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Gbd10

489
views

Published on

Published in: Business, Economy & Finance

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
489
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Generandoscript de consultas y subconsultas
     
    Base de datos (MySQL)
    Ing. Linda Masias Morales
  • 2. Alias para nombres de Columnas
    SELECT nombre as monitor
    FROM taarticulo
    SELECT nombre as monitor, imagen
    FROM taarticulo
    SELECT nombre as monitor, imagen as picture
    FROM taarticulo
  • 3. Alias para nombres de Columnas
    SELECT nombre as monitor, imagen as 'picture new' FROM taarticulo
    SELECT nombre as monitor, CONCAT(precio,’,’,stock) as resumen
    FROM taarticulo
  • 4. BETWEEN
    SELECT nombre as monitor, CONCAT(precio,’,’,stock) as resumen
    FROM taarticulo
    WHERE precio BETWEEN 200 and 300
  • 5. IN
    SELECT nombre as monitor, CONCAT(precio,',',stock) as resumen
    FROM taarticulo
    WHERE codproveedor IN (0617002, 0617004)
  • 6. NOT
    SELECT nombre as monitor, CONCAT(precio,',',stock) as resumen
    FROM taarticulo
    WHERE (precio<200)
    SELECT nombre as monitor, CONCAT(precio,',',stock) as resumen
    FROM taarticulo
    WHERE NOT (precio<200)
  • 7. Consultas de tiempo
    Tablaproducto
    SELECT category FROM producto WHERE (year(fecha)=2012)
    SELECT category FROM productoWHERE (day(fecha)=11)
    SELECT category FROM productoWHERE (month(fecha)=12)
    SELECT category FROM productoWHERE (hour(hora)=03)
    SELECT category FROM productoWHERE (minute(hora)=3)
    SELECT category FROM productoWHERE (second(hora)=32)
  • 8. ORDER BY
    SELECT * FROM taarticulo ORDER BY precio
    SELECT * FROM taarticulo ORDER BY precio ASC
    SELECT * FROM taarticulo ORDER BY precio DESC
    SELECT * FROM tacategoria ORDER BY nombre
    SELECT * FROM tacategoria ORDER BY nombre ASC
    SELECT * FROM tacategoria ORDER BY nombre DESC
  • 9. ORDER BY
    SELECT * FROM taarticulo
    WHERE precio >= 250
    ORDER BY precio
  • 10. ORDER BY
    SELECT * FROM taarticulo
    WHERE precio >= 150
    ORDER BY 3

×