- tag (HTML), 613 ul() function (Perl), 613 uncertainty principle, 775 834 | Index undef argument (Perl) about, 92, 117 binding to placeholders, 85 do() method and, 45, 68 underscore (_), 149, 158, 360 Unicode character sets, 140 UNINSTALL PLUGIN statement, 762 unique element (Ruby), 344 UNIQUE keyword, 377, 451, 550–551 Unix epoch, 204, 208 Unix systems configuring Apache, 582 error log, 764 invoking shell commands, 370 line-ending sequence in, 376 localhost and, measuring time in, 204, 208 option file and, 13, 97 output column delimiters, 21 root user, terminating sessions, web security note, 584 unix_socket option PHP support, 37 Python support, 39 UNIX_TIMESTAMP() function adding date-and-time values, 215 converting intervals, 207 converting values, 201, 204 unordered lists, 613 UNSIGNED keyword, 450, 460 UPDATE privilege, 795 UPDATE statement about, 66 determining number of rows affected, 337 hit counters, 714 LIMIT clause and, 124 logging changes to tables, 324 Perl support, 67 PHP support, 74 result sets and, 350 Ruby support, 72 security vulnerabilities, 692 session data and, 740 simulating TIMESTAMP properties, 320– 322 tracking row modification times, 193 triggers and, 307 uploadInfo() function (Perl), 696 uploading files, 694–700 upload_max_filesize variable (PHP), 698 upload_tmp_dir variable (PHP), 698 [:upper:] character class (POSIX), 163 upper option, 405 UPPER() function, 153 Uptime status variable, 773–774 url() method (Perl), 651 urlencode() function (PHP), 602 urllib module (Python), 580, 590, 602 URLs encoding special characters, 597–603 parameter separator characters, 681 pattern matching for, 424 sesion tracking and, 755 use function (Perl), 31 USE statement, 67 user accounts account-creation helper procedure, 787 assigning and checking privileges, 788–790 creating, 786–787 disabling, 800 finding and fixing insecure, 796–800 login accounts and, managing, 785–790 modifying “any host” accounts, 802 modifying “many host” accounts, 802 removing, 790 removing anonymous accounts, 801 renaming, 790 setting up, 2–4 User directive, 585 USER() function, 151 user-defined variables in statements, 22–24 username (-u) option, 3, 8, 97 usernames obtaining connection parameters, 95 pattern matching, 424 sorting by hidden values, 242 USING clause, 474, 477, 486 UTC time standard converting values, 187 determining current date or time, 190 Unix epoch and, 204, 208 UTC_DATE function, 190 UTC_TIME() function, 190 UTC_TIMESTAMP() function, 190 utf16 character set, 140 utf16le character set, 140 utf32 character set, 140 utf8 character set, 140, 145, 146 utf8mb4 character set, 140 V -v ( verbose) option, 22 %v format specifier, 723 validate_password plug-in, 791–793 validate_password_dictionary_file system vari‐ able, 792 VALIDATE_PASSWORD_STRENGTH() func‐ tion, 793, 795 validating data about, 411–414 client-server considerations, 413 collecting web input, 680 on date or time subparts, 432–435 with lookup tables, 428–431 pattern matching and, 415–417 SQL mode and, 410–411 with table metadata, 425–428 on web forms, 689–690 value attribute (HTML), 655, 675 VARBINARY data type, 139, 145 VARCHAR data type, 139, 145, 719 variables configuration, 52 environment, 52 setting explicitly, 24 status, 770 system, 759, 770 user-defined in statements, 22–24 VARIANCE() function, 513 variation, measures of, 513 VAR_POP() function, 513 VAR_SAMP() function, 513 verbose (-v) option, 22 VERSION() function, 365–366 versions (server), applications adapting to, 364– 366 vertical (-E) option, 14 vhost log format, 723 views simplifying table access, 117 simplifying using summaries, 279 W %W format sequence, 185 Index | 835 -w option Perl support, 31, 92 Ruby support, 33 \w pattern element (Perl), 416 \W pattern element (Perl), 416 WAR files, 593 warn option, 438 wasNull() method (Java), 94 web forms about, 647–650 checking values on, 429 collecting web input, 679–689 creating multiple-pick elements, 669–674 creating single-pick elements, 653–668 generating from scripts, 650–653 loading database content into, 674–679 navigating across pages, 703–708 processing file uploads, 694–700 storing web input in databases, 691–693 validating web input, 689–690 web-based database searches, 700–703 web input, 647 (see also web forms) about, 647–650 collecting, 679–689 extraction conventions, 681–689 generating “click to sort” table headings, 708–712 navigating web pages, 703–708 storing in databases, 691–693 validating, 689–690 web page access counting, 712–716 web page access logging, 716 web page access logging with Apache, 717– 724 web programming debugging scripts, 584 encoding special characters in output, 596– 603 running web scripts with Apache, 581–591 running web scripts with Tomcat, 591–596 web page generation, 579–581 web scripts collecting web input, 679 debugging, 584 determining actions, 708–712 generating web forms, 650–653 running with Apache, 581–591 running with Tomcat, 591–596 836 | Index session storage for Java, 748–756 session storage for Perl, 728–734 session storage for PHP, 738–748 session storage for Ruby, 734–738 trying to break, 692 web-based database searches, 700–703 WEEKDAY() function, 195–196, 221, 250 WHERE clause aggregate functions and, 281 associating rows in multiple tables, 474–479 checking existence of tables, 355 cloning tables and, 128 column aliases and, 111 date or time condition, 228–231 HAVING clause and, 290 narrowing down result sets, 706 NULL values and, 484 obtaining table structure, 358 saving query results, 129 selecting specific columns, 106–108 selecting specific rows, 106–108 specifying database object names, 90 user-defined variables in, 22 views for table access, 118 WHILE statement, 310 whitespace pattern identifying, 418 stripping from values, 416 Windows systems configuring Apache, 582 continuation character in, 371 invoking shell commands, 370 line-ending sequence in, 376 pathname separators in, 11, 54, 374 setting file permissions, 13 WITH ROLLUP clause, 300–302 Workbench program (MySQL), writing MySQL-based programs (see API oper‐ ations) X -X ( xml) option, 19 x repetition operator, 84 [:xdigit:] character class (POSIX), 163 XHTML, 578 xml (-X) option, 19 XML documents exporting query results as, 398–401 importing into MySQL, 401–404 producing, 18–20 XML::Generator::DBI module (Perl), 399 XML::Handler::YAWriter module (Perl), 399 XML::XPath module (Perl), 402 XSLT transforms, 19 Y %Y format sequence, 184–186 %y format sequence, 185 YEAR() function about, 184, 195–196 leap-year calculations and, 224 pattern matching and, 160 YY-MM-DD format, 422 yy_to_ccyy() function, 432 Z zero parts in dates and times, 411 Zip codes, 419 Index | 837 About the Author Paul DuBois is one of the primary contributors to the MySQL Reference Manual, a renowned online manual that has supported MySQL administrators and database de‐ velopers for years He is a member of the MySQL documentation team at Oracle Cor‐ poration and is also the author of MySQL (Addison-Wesley Professional); MySQL Cookbook; Using csh & tcsh; Software Portability with imake; and MySQL and Perl for the Web (New Riders) Colophon The animal on the cover of MySQL Cookbook, Third Edition is a green anole These common lizards can be found in the southeastern United States, the Caribbean, and South America Green anoles dwell in moist, shady enivornments, such as inside trees and shrubs They subsist on small insects like crickets, roaches, moths, grubs, and spi‐ ders Green anoles are slight in build, with narrow heads and long, slender tails that can be twice as long as their bodies The special padding on their feet enables them to climb, cling to, and run on any surface They range in size from six to eight inches long Though, as their name implies, green anoles are usually bright green, their color can change to match their surroundings, varying among gray-brown, brown, and green Male anoles have pink dewlaps that they extend when courting or protecting their territory The cover image is from the Dover Pictorial Archive The cover fonts are URW Type‐ writer and Guardian Sans The text font is Adobe Minion Pro; the heading font is Adobe Myriad Condensed; and the code font is Dalton Maag’s Ubuntu Mono ... with Short Words 5 .14 Requiring or Prohibiting Full-Text Search Words 5 .15 Performing Full-Text Phrase Searches 14 0 14 4 14 6 14 8 15 0 15 3 15 5 15 8 16 0 16 5 16 8 16 9 17 3 17 5 17 7 Working with Dates and. .. Contents 18 0 18 2 18 3 18 7 18 9 19 0 19 1 19 4 19 9 6 .10 Converting Between Temporal Values and Basic Units 6 .11 Calculating Intervals Between Dates or Times 6 .12 Adding Date or Time Values 6 .13 Calculating... solve MySQL problems from scratch d vi 3r Re MySQL Cookbook Paul DuBois THIRD EDITION MySQL Cookbook Paul DuBois MySQL Cookbook , Third Edition by Paul DuBois Copyright © 2 014 Paul DuBois and O’Reilly