Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases Reporting with SQL Date and Time Functions Review: Reporting with SQL

What is the correct way of using the REPLACE() function for replacing "javascript" with "JavaScript" ?

This is a question from the review exercise in the date and time functions course.

2 Answers

Umesh Ravji
Umesh Ravji
42,386 Points

https://teamtreehouse.com/library/reporting-with-sql/working-with-text/replacing-portions-of-text

SELECT REPLACE(<original value or column>, <target string>, <replacement string>) FROM <table>;

You could read this as

SELECT REPLACE(<text>, <thing you want to replace>, <thing you want to replace it with>);
jason chan
jason chan
31,009 Points

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace

var re = /apples/gi;
var str = 'Apples are round, and apples are juicy.';
var newstr = str.replace(re, 'oranges');
console.log(newstr);  // oranges are round, and oranges are juicy.

Regex tutorial

https://regexone.com/