topical media & game development

talk show tell print

basic-mysql-06-ch06-TryItOut.sql / sql



  
  /* Chapter 6 - Try It Out sections */
  
  /* Try It Out: Using UPDATE Statements to Modify Data in Joined Tables */
  
  UPDATE DVDs, Studios
  SET DVDs.StatID='s2'
  WHERE DVDs.StudID=Studios.StudID
     AND Studios.StudDescrip='Metro-Goldwyn-Mayer';
  
  /*Try It Out: Using the <from join delete> Alternative to Delete Data from the DVDRentals Database*/
  
  DELETE DVDs
  FROM DVDs, Studios
  WHERE DVDs.StudID=Studios.StudID
     AND Studios.StudDescrip='New Line Cinema';
  
  DELETE DVDs
  FROM DVDs, Studios
  WHERE DVDs.StudID=Studios.StudID
     AND Studios.StudDescrip='Metro-Goldwyn-Mayer';
  
  /* Using the <using join delete> Alternative to Delete Data from the DVDRentals Database */
  
  DELETE FROM DVDs
  USING DVDs, Studios
  WHERE DVDs.StudID=Studios.StudID
     AND Studios.StudDescrip='New Line Cinema';
  
  DELETE FROM DVDs
  USING DVDs, Studios
  WHERE DVDs.StudID=Studios.StudID
     AND Studios.StudDescrip='Metro-Goldwyn-Mayer';
  
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.