Question 1 = (Single UPDATE Statement) With a single statement change the emails
ID: 3841821 • Letter: Q
Question
Question 1 = (Single UPDATE Statement)
With a single statement change the emails of all the members to the format "LastName@ArtistName.com".
Use the replace function to get rid of spaces in the artistname
e.g.
SELECT REPLACE(ArtistName, " ", "") FROM Artists;
The above lists all the artistnames with spaces removed
After you are done, this is how the output should look like:
mysql> select firstname, email from members;
+-----------+-----------------------------+
| firstname | email |
+-----------+-----------------------------+
| Bryce | Sanders@TheNeurotics.com |
| Marcellin | Lambert@Sonata.com |
| Caroline | Kale@Sonata.com |
| Kerry | Fernandez@Sonata.com |
| Roberto | Alvarez@Word.com |
| Mary | Chrisman@Word.com |
Explanation / Answer
Find the answers below.
1. UPDATE Members
SET EMail = (SELECT CONCAT(LastName,'@',ArtistName,'.com') FROM Members a, XrefArtistsMembers b, Artists c where a.MemberID = b.MemberID and b.ArtistID = c.ArtistID);
2. select FirstName from SalesPeople a, Members b, XrefArtistsMembers c, Artists d where a.SalesID = b.SalesID and b.MemberID = c.MemberID and c.ArtistID = d.ArtistID and d.ArtistName = 'Bullets'
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.