January 2018
Intermediate to advanced
446 pages
12h 57m
English
MySQL provides numerous inbuilt functions. You have already used the CURDATE() function to get the current date.
You can use the functions in the WHERE clause:
mysql> SELECT * FROM employees WHERE hire_date = CURDATE();
mysql> SELECT DATE_ADD(CURDATE(), INTERVAL -7 DAY) AS '7 Days Ago';
mysql> SELECT CONCAT(first_name, ' ', last_name) FROM employees LIMIT 1;+------------------------------------+| CONCAT(first_name, ' ', last_name) |+------------------------------------+| Aamer Anger |+------------------------------------+1 row in set (0.00 sec)
Read now
Unlock full access