Database Reference
In-Depth Information
Now try the same search using the Soundex() function to match all contact
names that sound similar to Y. Lie :
Input
SELECT cust_name, cust_contact
FROM customers
WHERE Soundex(cust_contact) = Soundex('Y Lie');
Output
+-------------+--------------+
| cust_name | cust_contact |
+-------------+--------------+
| Coyote Inc. | Y Lee |
+-------------+--------------+
Analysis
In this example, the WHERE clause uses the Soundex() function to con-
vert both the cust_contact column value and the search string to their
SOUNDEX values. Because Y. Lee and Y. Lie sound alike, their
SOUNDEX values match, and so the WHERE clause correctly filtered the
desired data.
Date and Time Manipulation Functions
Date and times
are stored in tables using special datatypes using special internal
formats so they may be sorted or filtered quickly and efficiently, as well as to
save physical storage space.
The format used to store dates and times is usually of no use to your applica-
tions, and so date and time functions are almost always used to read, expand,
and manipulate these values. Because of this, date and time manipulation func-
tions are some of the most important functions in the MariaDB SQL language.
Table 11.2 lists some commonly used date and time manipulation functions.
Table 11.2 Commonly Used Date and Time Manipulation Functions
Function
Description
AddDate()
Add to a date (days, weeks, and so on)
AddTime()
Add to a time (hours, minutes, and so on)
CurDate()
Returns the current date
CurTime()
Returns the current time
Date()
Returns the date portion of a date time
DateDiff()
Calculates the difference between two dates
 
 
Search WWH ::




Custom Search