This MySQL function returns the number for the day of the week. Monday is considered the first day of the week.
Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).
This function returns the number for the day of the week. Monday is considered the first day of the week for this function and it returns a value of 0; a Sunday date returns 6.
SELECT appt_id, client_id FROM appointments WHERE WEEKDAY(appt) > 4 AND EXTRACT(YEAR_MONTH FROM appt) = EXTRACT(YEAR_MONTH FROM NOW( ));
This SQL statement, based on the WHERE clause, will retrieves a list of appointments that are on the weekends of the current month.