28 Working with multiple
relegated to \"race music\" (the music industry code name for rhythm and
blues) outlets and was rarely heard by mainstream white audiences. In
1951, Cleveland, Ohio disc jockey Alan Freed would begin playing this type
of music for his white audience, and it is Freed who is credited with
coining the phrase \"rock and roll\" to describe the rollicking R&B music
that he brought to the airwaves." where genre="Rock"
I pulled this information off of Wikipedia (http://en.wikipedia.org/). You may find it easier
to go there and copy  some of this text out. Remember to watch out for quotes! You cannot
surround your text with the same kind of quotes that the text contains unless you backquote
the quotes in the text, as I've done with the history of rock above.
The final step is to replace the genres in the songs table with the genre ID we've just created.
First, create an unsigned integer column in songs called  genreID .
Since  we'll  be  searching  on  this  genreID,  you'll  want  to  create  a  standard  index  for  the
column as well.
Now, let's set the genre ID to the correct ID from the genres table. First, we text the where
we're going to use.
select song, artist, songs.genre, genres.genre, genres.id
from songs, genres
where songs.genre=genres.genre
If  that  shows  you  what  you'd  expect  to  see,  backup  your  data  (always  backup  your  data
before making a potentially data threatening change such as this!) and convert that select
into an update:
update songs, genres set genreID=genres.id where songs.genre=genres.genre
This may take a while! It has 7,000 records to update.
You should now be able to get genre information for any songs whose genre you've entered
information for. You'll only have to enter that information once for all songs of that genre;
and if you alter the name of the genre that alteration will follow through as long as the genre
ID stays the same.
select song, artist, description
from songs left join genres on songs.genreID=genres.id
where song like "%chain%"
order by artist
This  will  show  all  songs  whose  name  contains   chain ,  along  with  the  artist  and  the
description of the genre.




  

Home

About Services Network Support FAQ Order Contact
 

Php MySQL Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved