11.09.2018 Views

Aprender a desarrollar un sitio Web con PHP y MySQL

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Select Nombre,<br />

Apellidos,<br />

Edad,<br />

CASE WHEN Edad > 60 THEN ’SENIOR’<br />

WHEN Edad BETWEEN 35 AND 60 THEN ’Medio’<br />

WHEN Edad < 35 THEN ’J<strong>un</strong>ior’<br />

END as Categoría<br />

FROM Persona<br />

ORDER BY Nombre<br />

Copie esta <strong>con</strong>sulta en la pestaña SQL de <strong>PHP</strong>MyAdmin y haga clic en Continuar:<br />

p. Examinar la fecha actual<br />

Las f<strong>un</strong>ciones CURDATE() y CURRENT_DATE() devuelven la fecha actual en formato aaaa-mm-dd.<br />

Las f<strong>un</strong>ciones CURTIME() y CURRENT_TIME() devuelven la hora actual en formato hh:mm:ss.<br />

Las f<strong>un</strong>ciones NOW(), LOCALTIME() y CURRENT_TIMESTAMP() devuelven la fecha y la hora<br />

actuales.<br />

Por ejemplo:<br />

SELECT CURDATE(), CURTIME(), NOW(), LOCALTIME(), CURRENT_TIMESTAMP()<br />

Copie esta <strong>con</strong>sulta en la pestaña SQL de <strong>PHP</strong>MyAdmin y haga clic en Continuar:<br />

q. Extraer la fecha de <strong>un</strong> campo date y hora<br />

La instrucción que permite devolver la parte de la fecha de <strong>un</strong> campo que <strong>con</strong>tiene la fecha y la hora<br />

www.FreeLibros.me

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!