REPLACE(x,y,z) is a string function that replaces the character string y in the character string x with the character string z.
|
Result of the REPLACE(x,y,z) function |
REPLACE(x,y) |
The character string y in x is deleted |
x is a NULL value |
|
y is NULL value |
x remains unchanged |
z is NULL value |
The character string y in x is deleted |
Example table: hotel
The abbreviated notation for Street (St.) is to be written out in full (Street) for the sake of uniformity.
SELECT hno, zip, city, REPLACE (address,' t.' ,' treet' ) address
FROM hotel where address like '%tr%'
HNO |
ZIP |
CITY |
ADDRESS |
10 |
89477 |
Detroit |
155 Beechwood Street |
20 |
86159 |
Cincinnati |
1499 Grove Street |
80 |
20251 |
Los Angeles |
12 Barnard Street |
100 |
50668 |
Dallas |
1980 34th Street |
110 |
81245 |
New York |
111 78th Street |
See also: