MySQL Basics In Pictures
  1. Save random.pl in the programs directory.

    Then close the text editor.

    The main difference between this program and the presidents.pl program lies in $query.

    In this program, instead of selecting data only from the names table, the query selects data from two tables: name and quote:

    FROM quote,name

    It returns a president's name and his quote:

    print "\"$quote\"\n";
    print " - $first ";
    print "$middle " if ($middle);
    print "$last\n";

    As its name suggests, random.pl selects a president's quote at random:

    FROM quote,name
    WHERE quote.id=$random
  2. Open a terminal window and type:

    cd programs

    then press ENTER.