Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > ebb1914cf182a88528b4547490db1dd8 > files > 373

kdewebdev-quanta-doc-3.5.9-2mdv2008.1.x86_64.rpm

<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Chapter 1. General Information</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1"><link rel="start" href="index.html" title="MySQL 5.0 Reference Manual"><link rel="up" href="index.html" title="MySQL 5.0 Reference Manual"><link rel="prev" href="preface.html" title="Preface"><link rel="next" href="installing.html" title="Chapter 2. Installing MySQL"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 1. General Information</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="preface.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="installing.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="introduction"></a>Chapter 1. General Information</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="introduction.html#manual-info">1.1. About This Manual</a></span></dt><dt><span class="section"><a href="introduction.html#manual-conventions">1.2. Conventions Used in This Manual</a></span></dt><dt><span class="section"><a href="introduction.html#what-is-mysql-ab">1.3. Overview of MySQL AB</a></span></dt><dt><span class="section"><a href="introduction.html#what-is">1.4. Overview of the MySQL Database Management System</a></span></dt><dd><dl><dt><span class="section"><a href="introduction.html#history">1.4.1. History of MySQL</a></span></dt><dt><span class="section"><a href="introduction.html#features">1.4.2. The Main Features of MySQL</a></span></dt><dt><span class="section"><a href="introduction.html#stability">1.4.3. MySQL Stability</a></span></dt><dt><span class="section"><a href="introduction.html#table-size">1.4.4. How Big MySQL Tables Can Be</a></span></dt><dt><span class="section"><a href="introduction.html#year-2000-compliance">1.4.5. Year 2000 Compliance</a></span></dt></dl></dd><dt><span class="section"><a href="introduction.html#maxdb">1.5. Overview of the MaxDB Database Management System</a></span></dt><dd><dl><dt><span class="section"><a href="introduction.html#maxdb-overview">1.5.1. What is MaxDB?</a></span></dt><dt><span class="section"><a href="introduction.html#maxdb-history">1.5.2. History of MaxDB</a></span></dt><dt><span class="section"><a href="introduction.html#maxdb-features">1.5.3. Features of MaxDB</a></span></dt><dt><span class="section"><a href="introduction.html#maxdb-licensing">1.5.4. Licensing and Support</a></span></dt><dt><span class="section"><a href="introduction.html#maxdb-mysql-differences">1.5.5. Feature Differences Between MaxDB and MySQL</a></span></dt><dt><span class="section"><a href="introduction.html#maxdb-mysql-interoperability">1.5.6. Interoperability Features Between MaxDB and MySQL</a></span></dt><dt><span class="section"><a href="introduction.html#maxdb-links">1.5.7. MaxDB-Related Links</a></span></dt></dl></dd><dt><span class="section"><a href="introduction.html#roadmap">1.6. MySQL Development Roadmap</a></span></dt><dd><dl><dt><span class="section"><a href="introduction.html#mysql-5-0-nutshell">1.6.1. What's New in MySQL 5.0</a></span></dt></dl></dd><dt><span class="section"><a href="introduction.html#mysql-information-sources">1.7. MySQL Information Sources</a></span></dt><dd><dl><dt><span class="section"><a href="introduction.html#questions">1.7.1. MySQL Mailing Lists</a></span></dt><dt><span class="section"><a href="introduction.html#irc">1.7.2. MySQL Community Support on IRC (Internet Relay Chat)</a></span></dt><dt><span class="section"><a href="introduction.html#forums">1.7.3. MySQL Community Support at the MySQL Forums</a></span></dt></dl></dd><dt><span class="section"><a href="introduction.html#compatibility">1.8. MySQL Standards Compliance</a></span></dt><dd><dl><dt><span class="section"><a href="introduction.html#standards">1.8.1. What Standards MySQL Follows</a></span></dt><dt><span class="section"><a href="introduction.html#sql-mode">1.8.2. Selecting SQL Modes</a></span></dt><dt><span class="section"><a href="introduction.html#ansi-mode">1.8.3. Running MySQL in ANSI Mode</a></span></dt><dt><span class="section"><a href="introduction.html#extensions-to-ansi">1.8.4. MySQL Extensions to Standard SQL</a></span></dt><dt><span class="section"><a href="introduction.html#differences-from-ansi">1.8.5. MySQL Differences from Standard SQL</a></span></dt><dt><span class="section"><a href="introduction.html#constraints">1.8.6. How MySQL Deals with Constraints</a></span></dt></dl></dd></dl></div><a class="indexterm" name="id2756297"></a><a class="indexterm" name="id2756303"></a><p>
    The MySQL® software delivers a very fast, multi-threaded,
    multi-user, and robust SQL (Structured Query Language) database
    server. MySQL Server is intended for mission-critical, heavy-load
    production systems as well as for embedding into mass-deployed
    software. MySQL is a registered trademark of MySQL AB.
  </p><p>
    The MySQL software is Dual Licensed. Users can choose to use the
    MySQL software as an Open Source product under the terms of the GNU
    General Public License (<a href="http://www.fsf.org/licenses/" target="_top">http://www.fsf.org/licenses/</a>)
    or can purchase a standard commercial license from MySQL AB. See
    <a href="http://www.mysql.com/company/legal/licensing/" target="_top">http://www.mysql.com/company/legal/licensing/</a> for
    more information on our licensing policies.
  </p><p>
    The following list describes some sections of particular interest in
    this manual:
  </p><div class="itemizedlist"><ul type="disc"><li><p>
        For a discussion about the capabilities of the MySQL Database
        Server, see <a href="introduction.html#features" title="1.4.2. The Main Features of MySQL">Section 1.4.2, “The Main Features of MySQL”</a>.
      </p></li><li><p>
        For installation instructions, see <a href="installing.html" title="Chapter 2. Installing MySQL">Chapter 2, <i>Installing MySQL</i></a>.
      </p></li><li><p>
        For tips on porting the MySQL Database Software to new
        architectures or operating systems, see
        <a href="porting.html" title="Appendix E. Porting to Other Systems">Appendix E, <i>Porting to Other Systems</i></a>.
      </p></li><li><p>
        For information about upgrading from a Version 4.1 release, see
        <a href="installing.html#upgrading-from-4-1" title="2.10.2. Upgrading from Version 4.1 to 5.0">Section 2.10.2, “Upgrading from Version 4.1 to 5.0”</a>.
      </p></li><li><p>
        For a tutorial introduction to the MySQL Database Server, see
        <a href="tutorial.html" title="Chapter 3. Tutorial">Chapter 3, <i>Tutorial</i></a>.
      </p></li><li><p>
        For examples of SQL and benchmarking information, see the
        benchmarking directory (<code class="filename">sql-bench</code> in the
        distribution).
      </p></li><li><p>
        For a history of new features and bugfixes, see
        <a href="news.html" title="Appendix D. MySQL Change History">Appendix D, <i>MySQL Change History</i></a>.
      </p></li><li><p>
        For a list of currently known bugs and misfeatures, see
        <a href="problems.html#bugs" title="A.8. Known Issues in MySQL">Section A.8, “Known Issues in MySQL”</a>.
      </p></li><li><p>
        For future plans, see <a href="introduction.html#roadmap" title="1.6. MySQL Development Roadmap">Section 1.6, “MySQL Development Roadmap”</a>.
      </p></li><li><p>
        For a list of all the contributors to this project, see
        <a href="credits.html" title="Appendix C. Credits">Appendix C, <i>Credits</i></a>.
      </p></li></ul></div><p>
    <span class="bold"><strong>Important</strong></span>:
  </p><p>
    Reports of errors (often called “<span class="quote">bugs</span>”), as well as
    questions and comments, should be sent to
    <a href="http://bugs.mysql.com" target="_top">http://bugs.mysql.com</a>. See
    <a href="introduction.html#bug-reports" title="1.7.1.3. How to Report Bugs or Problems">Section 1.7.1.3, “How to Report Bugs or Problems”</a>.
  </p><p>
    If you have found a sensitive security bug in MySQL Server, please
    let us know immediately by sending an email message to
    <code class="email">&lt;<a href="mailto:security@mysql.com">security@mysql.com</a>&gt;</code>.
  </p><a class="indexterm" name="id2756500"></a><a class="indexterm" name="id2756510"></a><a class="indexterm" name="id2756519"></a><a class="indexterm" name="id2756526"></a><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="manual-info"></a>1.1. About This Manual</h2></div></div></div><a class="indexterm" name="id2756547"></a><a class="indexterm" name="id2756553"></a><p>
      This is the Reference Manual for the MySQL Database System,
      Version 5.0, up to Release 5.0.16. It is
      not intended for use with older versions of the MySQL software due
      to the many functional and other differences between MySQL
      5.0 and previous versions.

      

      If you are using a Version 4.1 release of the MySQL
      software, please refer to the
      <em class="citetitle">MySQL 4.1 Reference Manual</em>, which provides
      coverage of the 3.22, 3.23, 4.0, and 4.1 series of MySQL software
      releases. Differences between minor versions of MySQL
      5.0 are noted in the present text with reference to
      release numbers (5.0.<em class="replaceable"><code>x</code></em>).
    </p><p>
      Because this manual serves as a reference, it does not provide
      general instruction on SQL or relational database concepts. It
      also does not teach you how to use your operating system or
      command-line interpreter.
    </p><p>
      The MySQL Database Software is under constant development, and the
      Reference Manual is updated frequently as well. The most recent
      version of the manual is available online in searchable form at
      <a href="http://dev.mysql.com/doc/" target="_top">http://dev.mysql.com/doc/</a>. Other formats also are available,
      including HTML, PDF, and Windows CHM versions.
    </p><a class="indexterm" name="id2756618"></a><a class="indexterm" name="id2756628"></a><p>
      The primary document is a set of
      <a href="http://docbook.org/" target="_top">DocBook</a> XML files. The
      HTML version and other formats are produced automatically using,
      among other tools, the
      <a href="http://docbook.sourceforge.net/release/xsl/current/doc/reference.html" target="_top">DocBook
      XSL stylesheets</a>.

      
    </p><p>
      If you have any suggestions concerning additions or corrections to
      this manual, please send them to the documentation team at
      <code class="email">&lt;<a href="mailto:docs@mysql.com">docs@mysql.com</a>&gt;</code>.
    </p><p>
      This manual was initially written by David Axmark and Michael
      “<span class="quote">Monty</span>” Widenius. It is maintained by the MySQL
      Documentation Team, consisting of Paul DuBois, Stefan Hinz, Mike
      Hillyer, and Jon Stephens. For the many other contributors, see
      <a href="credits.html" title="Appendix C. Credits">Appendix C, <i>Credits</i></a>.
    </p><p>
      The copyright to this manual is owned by the Swedish company MySQL
      AB. MySQL® and the MySQL logo are registered trademarks of
      MySQL AB. Other trademarks and registered trademarks referred to
      in this manual are the property of their respective owners, and
      are used for identification purposes only.
    </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="manual-conventions"></a>1.2. Conventions Used in This Manual</h2></div></div></div><p>
    This manual uses certain typographical conventions:
  </p><a class="indexterm" name="id2756731"></a><a class="indexterm" name="id2756742"></a><a class="indexterm" name="id2756751"></a><div class="itemizedlist"><ul type="disc"><li><p>
        <code class="literal">Text in this style</code> is used for SQL
        statements; database, table, and column names; C and Perl code;
        and environment variables. Example: “<span class="quote">To reload the grant
        tables, use the <code class="literal">FLUSH PRIVILEGES</code>
        statement</span>”.
      </p><p>
        <strong class="userinput"><code>Text in this style</code></strong> is used to indicate
        input that you type in examples.
      </p></li><li><p>
        <span><strong class="command">Text in this style</strong></span> is used to indicate the
        names of executable programs and scripts, examples being
        <span><strong class="command">mysql</strong></span> (the MySQL command line client program)
        and <span><strong class="command">mysqld</strong></span> (the MySQL server executable).
      </p></li><li><p>
        <em class="replaceable"><code>Text in this style</code></em> is used for
        variable input for which you should substitute a value of your
        own choosing.
      </p></li><li><p>
        Filenames and directory names are written like this: “<span class="quote">The
        global <code class="filename">my.cnf</code> file is located in the
        <code class="filename">/etc</code> directory</span>”.
      </p></li><li><p>
        Character sequences are written like this: “<span class="quote">To specify a
        wildcard, use the ‘<code class="literal">%</code>’
        character</span>”.
      </p></li><li><p>
        <span class="emphasis"><em>Text in this style</em></span> is used for emphasis.
      </p></li><li><p>
        <span class="bold"><strong>Text in this style</strong></span> is used in
        table headings and to convey especially strong emphasis.
      </p></li></ul></div><p>
    When commands are shown that are meant to be executed from within a
    particular program, the program is indicated by a prompt shown
    before the command. For example, <code class="literal">shell&gt;</code>
    indicates a command that you execute from your login shell, and
    <code class="literal">mysql&gt;</code> indicates a statement that you execute
    from the <span><strong class="command">mysql</strong></span> client program:
  </p><pre class="programlisting">shell&gt; <strong class="userinput"><code>type a shell command here</code></strong>
mysql&gt; <strong class="userinput"><code>type a mysql statement here</code></strong>
</pre><p>
    The “<span class="quote">shell</span>” is your command interpreter. On Unix, this
    is typically a program such as <span><strong class="command">sh</strong></span>,
    <span><strong class="command">csh</strong></span>, or <span><strong class="command">bash</strong></span>. On Windows, the
    equivalent program is <span><strong class="command">command.com</strong></span> or
    <span><strong class="command">cmd.exe</strong></span>, typically run in a console window.
  </p><p>
    When you enter a command or statement shown in an example, do not
    type the prompt shown in the example.
  </p><p>
    Database, table, and column names must often be substituted into
    statements. To indicate that such substitution is necessary, this
    manual uses <em class="replaceable"><code>db_name</code></em>,
    <em class="replaceable"><code>tbl_name</code></em>, and
    <em class="replaceable"><code>col_name</code></em>. For example, you might see a
    statement like this:
  </p><pre class="programlisting">mysql&gt; <strong class="userinput"><code>SELECT <em class="replaceable"><code>col_name</code></em> FROM <em class="replaceable"><code>db_name</code></em>.<em class="replaceable"><code>tbl_name</code></em>;</code></strong>
</pre><p>
    This means that if you were to enter a similar statement, you would
    supply your own database, table, and column names, perhaps like
    this:
  </p><pre class="programlisting">mysql&gt; <strong class="userinput"><code>SELECT author_name FROM biblio_db.author_list;</code></strong>
</pre><p>
    SQL keywords are not case sensitive and may be written in uppercase
    or lowercase. This manual uses uppercase.
  </p><p>
    In syntax descriptions, square brackets
    (‘<code class="literal">[</code>’ and
    ‘<code class="literal">]</code>’) are used to indicate optional
    words or clauses. For example, in the following statement,
    <code class="literal">IF EXISTS</code> is optional:
  </p><pre class="programlisting">DROP TABLE [IF EXISTS] <em class="replaceable"><code>tbl_name</code></em>
</pre><p>
    When a syntax element consists of a number of alternatives, the
    alternatives are separated by vertical bars
    (‘<code class="literal">|</code>’). When one member from a set of
    choices <span class="emphasis"><em>may</em></span> be chosen, the alternatives are
    listed within square brackets (‘<code class="literal">[</code>’
    and ‘<code class="literal">]</code>’):
  </p><pre class="programlisting">TRIM([[BOTH | LEADING | TRAILING] [<em class="replaceable"><code>remstr</code></em>] FROM] <em class="replaceable"><code>str</code></em>)
</pre><p>
    When one member from a set of choices <span class="emphasis"><em>must</em></span> be
    chosen, the alternatives are listed within braces
    (‘<code class="literal">{</code>’ and
    ‘<code class="literal">}</code>’):
  </p><pre class="programlisting">{DESCRIBE | DESC} <em class="replaceable"><code>tbl_name</code></em> [<em class="replaceable"><code>col_name</code></em> | <em class="replaceable"><code>wild</code></em>]
</pre><p>
    An ellipsis (<code class="literal">...</code>) indicates the omission of a
    section of a statement, typically to provide a shorter version of
    more complex syntax. For example, <code class="literal">INSERT ...
    SELECT</code> is shorthand for the form of
    <code class="literal">INSERT</code> statement that is followed by a
    <code class="literal">SELECT</code> statement.
  </p><p>
    An ellipsis can also indicate that the preceding syntax element of a
    statement may be repeated. In the following example, multiple
    <em class="replaceable"><code>reset_option</code></em> values may be given, with
    each of those after the first preceded by commas:
  </p><pre class="programlisting">RESET <em class="replaceable"><code>reset_option</code></em> [,<em class="replaceable"><code>reset_option</code></em>] ...
</pre><p>
    Commands for setting shell variables are shown using Bourne shell
    syntax. For example, the sequence to set an environment variable and
    run a command looks like this in Bourne shell syntax:
  </p><pre class="programlisting">shell&gt; <strong class="userinput"><code><em class="replaceable"><code>VARNAME</code></em>=<em class="replaceable"><code>value</code></em> <em class="replaceable"><code>some_command</code></em></code></strong>
</pre><a class="indexterm" name="id2757145"></a><a class="indexterm" name="id2757154"></a><p>
    If you are using <span><strong class="command">csh</strong></span> or <span><strong class="command">tcsh</strong></span>,
    you must issue commands somewhat differently. You would execute the
    sequence just shown like this:
  </p><pre class="programlisting">shell&gt; <strong class="userinput"><code>setenv <em class="replaceable"><code>VARNAME</code></em> <em class="replaceable"><code>value</code></em></code></strong>
shell&gt; <strong class="userinput"><code><em class="replaceable"><code>some_command</code></em></code></strong>
</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="what-is-mysql-ab"></a>1.3. Overview of MySQL AB</h2></div></div></div><a class="indexterm" name="id2757208"></a><p>
    MySQL AB is the company of the MySQL founders and main developers.
    MySQL AB was originally established in Sweden by David Axmark, Allan
    Larsson, and Michael “<span class="quote">Monty</span>” Widenius.
  </p><p>
    We are dedicated to developing the MySQL database software and
    promoting it to new users. MySQL AB owns the copyright to the MySQL
    source code, the MySQL logo and (registered) trademark, and this
    manual. See <a href="introduction.html#what-is" title="1.4. Overview of the MySQL Database Management System">Section 1.4, “Overview of the MySQL Database Management System”</a>.
  </p><p>
    The MySQL core values show our dedication to MySQL and Open Source.
  </p><p>
    These core values direct how MySQL AB works with the MySQL server
    software:
  </p><div class="itemizedlist"><ul type="disc"><li><p>
        To be the best and the most widely used database in the world
      </p></li><li><p>
        To be available and affordable by all
      </p></li><li><p>
        To be easy to use
      </p></li><li><p>
        To be continuously improved while remaining fast and safe
      </p></li><li><p>
        To be fun to use and improve
      </p></li><li><p>
        To be free from bugs
      </p></li></ul></div><p>
    These are the core values of the company MySQL AB and its employees:
  </p><div class="itemizedlist"><ul type="disc"><li><p>
        We subscribe to the Open Source philosophy and support the Open
        Source community
      </p></li><li><p>
        We aim to be good citizens
      </p></li><li><p>
        We prefer partners that share our values and mindset
      </p></li><li><p>
        We answer email and provide support
      </p></li><li><p>
        We are a virtual company, networking with others
      </p></li><li><p>
        We work against software patents
      </p></li></ul></div><p>
    The MySQL Web site (<a href="http://www.mysql.com/" target="_top">http://www.mysql.com/</a>) provides
    the latest information about MySQL and MySQL AB.
  </p><p>
    By the way, the “<span class="quote">AB</span>” part of the company name is the
    acronym for the Swedish “<span class="quote">aktiebolag,</span>” or “<span class="quote">stock
    company.</span>” It translates to “<span class="quote">MySQL, Inc.</span>” In
    fact, MySQL, Inc. and MySQL GmbH are examples of MySQL AB
    subsidiaries. They are located in the US and Germany, respectively.
  </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="what-is"></a>1.4. Overview of the MySQL Database Management System</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="introduction.html#history">1.4.1. History of MySQL</a></span></dt><dt><span class="section"><a href="introduction.html#features">1.4.2. The Main Features of MySQL</a></span></dt><dt><span class="section"><a href="introduction.html#stability">1.4.3. MySQL Stability</a></span></dt><dt><span class="section"><a href="introduction.html#table-size">1.4.4. How Big MySQL Tables Can Be</a></span></dt><dt><span class="section"><a href="introduction.html#year-2000-compliance">1.4.5. Year 2000 Compliance</a></span></dt></dl></div><a class="indexterm" name="id2757400"></a><a class="indexterm" name="id2757412"></a><p>
    MySQL, the most popular Open Source SQL database management system,
    is developed, distributed, and supported by MySQL AB. MySQL AB is a
    commercial company, founded by the MySQL developers. It is a second
    generation Open Source company that unites Open Source values and
    methodology with a successful business model.
  </p><p>
    The MySQL Web site (<a href="http://www.mysql.com/" target="_top">http://www.mysql.com/</a>) provides
    the latest information about MySQL software and MySQL AB.
  </p><div class="itemizedlist"><ul type="disc"><li><p>
        MySQL is a database management system.
      </p><p>
        A database is a structured collection of data. It may be
        anything from a simple shopping list to a picture gallery or the
        vast amounts of information in a corporate network. To add,
        access, and process data stored in a computer database, you need
        a database management system such as MySQL Server. Since
        computers are very good at handling large amounts of data,
        database management systems play a central role in computing, as
        standalone utilities or as parts of other applications.
      </p></li><li><p>
        MySQL is a relational database management system.
      </p><p>
        <a class="indexterm" name="id2757474"></a>

        A relational database stores data in separate tables rather than
        putting all the data in one big storeroom. This adds speed and
        flexibility. The SQL part of “<span class="quote">MySQL</span>” stands for
        “<span class="quote">Structured Query Language.</span>” SQL is the most common
        standardized language used to access databases and is defined by
        the ANSI/ISO SQL Standard. The SQL standard has been evolving
        since 1986 and several versions exist. In this manual,
        “<span class="quote">SQL-92</span>” refers to the standard released in 1992,
        “<span class="quote">SQL:1999</span>” refers to the standard released in 1999,
        and “<span class="quote">SQL:2003</span>” refers to the current version of the
        standard. We use the phrase “<span class="quote">the SQL standard</span>” to
        mean the current version of the SQL Standard at any time.
      </p></li><li><p>
        MySQL software is Open Source.
      </p><p>
        <a class="indexterm" name="id2757770"></a>

        <a class="indexterm" name="id2757782"></a>

        <a class="indexterm" name="id2757794"></a>

        <a class="indexterm" name="id2757806"></a>

        Open Source means that it is possible for anyone to use and
        modify the software. Anybody can download the MySQL software
        from the Internet and use it without paying anything. If you
        wish, you may study the source code and change it to suit your
        needs. The MySQL software uses the GPL (GNU General Public
        License), <a href="http://www.fsf.org/licenses/" target="_top">http://www.fsf.org/licenses/</a>, to define
        what you may and may not do with the software in different
        situations. If you feel uncomfortable with the GPL or need to
        embed MySQL code into a commercial application, you can buy a
        commercially licensed version from us. See the MySQL Licensing
        Overview for more information
        (<a href="http://www.mysql.com/company/legal/licensing/" target="_top">http://www.mysql.com/company/legal/licensing/</a>).
      </p></li><li><p>
        The MySQL Database Server is very fast, reliable, and easy to
        use.
      </p><p>
        If that is what you are looking for, you should give it a try.
        MySQL Server also has a practical set of features developed in
        close cooperation with our users. You can find a performance
        comparison of MySQL Server with other database managers on our
        benchmark page. See <a href="optimization.html#mysql-benchmarks" title="7.1.4. The MySQL Benchmark Suite">Section 7.1.4, “The MySQL Benchmark Suite”</a>.
      </p><p>
        MySQL Server was originally developed to handle large databases
        much faster than existing solutions and has been successfully
        used in highly demanding production environments for several
        years. Although under constant development, MySQL Server today
        offers a rich and useful set of functions. Its connectivity,
        speed, and security make MySQL Server highly suited for
        accessing databases on the Internet.
      </p></li><li><p>
        MySQL Server works in client/server or embedded systems.
      </p><p>
        The MySQL Database Software is a client/server system that
        consists of a multi-threaded SQL server that supports different
        backends, several different client programs and libraries,
        administrative tools, and a wide range of application
        programming interfaces (APIs).
      </p><p>
        We also provide MySQL Server as an embedded multi-threaded
        library that you can link into your application to get a
        smaller, faster, easier-to-manage product.
      </p></li><li><p>
        A large amount of contributed MySQL software is available.
      </p><p>
        It is very likely that your favorite application or language
        supports the MySQL Database Server.
      </p></li></ul></div><a class="indexterm" name="id2757909"></a><a class="indexterm" name="id2757921"></a><a class="indexterm" name="id2757933"></a><p>
    The official way to pronounce “<span class="quote">MySQL</span>” is “<span class="quote">My Ess
    Que Ell</span>” (not “<span class="quote">my sequel</span>”), but we don't mind if
    you pronounce it as “<span class="quote">my sequel</span>” or in some other
    localized way.
  </p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="history"></a>1.4.1. History of MySQL</h3></div></div></div><a class="indexterm" name="id2757971"></a><a class="indexterm" name="id2757980"></a><a class="indexterm" name="id2757988"></a><a class="indexterm" name="id2757997"></a><a class="indexterm" name="id2758010"></a><a class="indexterm" name="id2758018"></a><p>
      We started out with the intention of using <code class="literal">mSQL</code>
      to connect to our tables using our own fast low-level (ISAM)
      routines. However, after some testing, we came to the conclusion
      that <code class="literal">mSQL</code> was not fast enough or flexible
      enough for our needs. This resulted in a new SQL interface to our
      database but with almost the same API interface as
      <code class="literal">mSQL</code>. This API was designed to allow
      third-party code that was written for use with
      <code class="literal">mSQL</code> to be ported easily for use with MySQL.
    </p><p>
      The derivation of the name MySQL is not clear. Our base directory
      and a large number of our libraries and tools have had the prefix
      “<span class="quote">my</span>” for well over 10 years. However, co-founder
      Monty Widenius's daughter is also named My. Which of the two gave
      its name to MySQL is still a mystery, even for us.
    </p><p>
      The name of the MySQL Dolphin (our logo) is “<span class="quote">Sakila,</span>”
      which was chosen by the founders of MySQL AB from a huge list of
      names suggested by users in our “<span class="quote">Name the Dolphin</span>”
      contest. The winning name was submitted by Ambrose Twebaze, an
      Open Source software developer from Swaziland, Africa. According
      to Ambrose, the feminine name Sakila has its roots in SiSwati, the
      local language of Swaziland. Sakila is also the name of a town in
      Arusha, Tanzania, near Ambrose's country of origin, Uganda.
    </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="features"></a>1.4.2. The Main Features of MySQL</h3></div></div></div><a class="indexterm" name="id2758096"></a><a class="indexterm" name="id2758105"></a><p>
      The following list describes some of the important characteristics
      of the MySQL Database Software. See also <a href="introduction.html#roadmap" title="1.6. MySQL Development Roadmap">Section 1.6, “MySQL Development Roadmap”</a>
      for more information about current and upcoming features.
    </p><div class="itemizedlist"><ul type="disc"><li><p>
          Internals and Portability
        </p><div class="itemizedlist"><ul type="circle"><li><p>
              Written in C and C++.
            </p></li><li><p>
              Tested with a broad range of different compilers.
            </p></li><li><p>
              Works on many different platforms. See
              <a href="installing.html#which-os" title="2.1.1. Operating Systems Supported by MySQL">Section 2.1.1, “Operating Systems Supported by MySQL”</a>.
            </p></li><li><p>
              Uses GNU Automake, Autoconf, and Libtool for portability.
            </p></li><li><p>
              APIs for C, C++, Eiffel, Java, Perl, PHP, Python, Ruby,
              and Tcl are available. See <a href="apis.html" title="Chapter 22. APIs and Libraries">Chapter 22, <i>APIs and Libraries</i></a>.
            </p></li><li><p>
              Fully multi-threaded using kernel threads. It can easily
              use multiple CPUs if they are available.
            </p></li><li><p>
              Provides transactional and non-transactional storage
              engines.
            </p></li><li><p>
              Uses very fast B-tree disk tables
              (<code class="literal">MyISAM</code>) with index compression.
            </p></li><li><p>
              Relatively easy to add another storage engine. This is
              useful if you want to add an SQL interface to an in-house
              database.
            </p></li><li><p>
              A very fast thread-based memory allocation system.
            </p></li><li><p>
              Very fast joins using an optimized one-sweep multi-join.
            </p></li><li><p>
              In-memory hash tables, which are used as temporary tables.
            </p></li><li><p>
              SQL functions are implemented using a highly optimized
              class library and should be as fast as possible. Usually
              there is no memory allocation at all after query
              initialization.
            </p></li><li><p>
              The MySQL code is tested with Purify (a commercial memory
              leakage detector) as well as with Valgrind, a GPL tool
              (<a href="http://developer.kde.org/~sewardj/" target="_top">http://developer.kde.org/~sewardj/</a>).
            </p></li><li><p>
              The server is available as a separate program for use in a
              client/server networked environment. It is also available
              as a library that can be embedded (linked) into standalone
              applications. Such applications can be used in isolation
              or in environments where no network is available.
            </p></li></ul></div></li><li><p>
          Column Types
        </p><div class="itemizedlist"><ul type="circle"><li><p>
              Many column types: signed/unsigned integers 1, 2, 3, 4,
              and 8 bytes long, <code class="literal">FLOAT</code>,
              <code class="literal">DOUBLE</code>, <code class="literal">CHAR</code>,
              <code class="literal">VARCHAR</code>, <code class="literal">TEXT</code>,
              <code class="literal">BLOB</code>, <code class="literal">DATE</code>,
              <code class="literal">TIME</code>, <code class="literal">DATETIME</code>,
              <code class="literal">TIMESTAMP</code>, <code class="literal">YEAR</code>,
              <code class="literal">SET</code>, <code class="literal">ENUM</code>, and
              OpenGIS spatial types. See <a href="column-types.html" title="Chapter 11. Column Types">Chapter 11, <i>Column Types</i></a>.
            </p></li><li><p>
              Fixed-length and variable-length records.
            </p></li></ul></div></li><li><p>
          Statements and Functions
        </p><div class="itemizedlist"><ul type="circle"><li><p>
              Full operator and function support in the
              <code class="literal">SELECT</code> and <code class="literal">WHERE</code>
              clauses of queries. For example:
            </p><pre class="programlisting">mysql&gt; <strong class="userinput"><code>SELECT CONCAT(first_name, ' ', last_name)</code></strong>
    -&gt; <strong class="userinput"><code>FROM citizen</code></strong>
    -&gt; <strong class="userinput"><code>WHERE income/dependents &gt; 10000 AND age &gt; 30;</code></strong>
</pre></li><li><p>
              Full support for SQL <code class="literal">GROUP BY</code> and
              <code class="literal">ORDER BY</code> clauses. Support for group
              functions (<code class="literal">COUNT()</code>,
              <code class="literal">COUNT(DISTINCT ...)</code>,
              <code class="literal">AVG()</code>, <code class="literal">STD()</code>,
              <code class="literal">SUM()</code>, <code class="literal">MAX()</code>,
              <code class="literal">MIN()</code>, and
              <code class="literal">GROUP_CONCAT()</code>).
            </p></li><li><p>
              Support for <code class="literal">LEFT OUTER JOIN</code> and
              <code class="literal">RIGHT OUTER JOIN</code> with both standard SQL
              and ODBC syntax.
            </p></li><li><p>
              Support for aliases on tables and columns as required by
              standard SQL.
            </p></li><li><p>
              <code class="literal">DELETE</code>, <code class="literal">INSERT</code>,
              <code class="literal">REPLACE</code>, and <code class="literal">UPDATE</code>
              return the number of rows that were changed (affected). It
              is possible to return the number of rows matched instead
              by setting a flag when connecting to the server.
            </p></li><li><p>
              The MySQL-specific <code class="literal">SHOW</code> command can be
              used to retrieve information about databases, database
              engines, tables, and indexes. The
              <code class="literal">EXPLAIN</code> command can be used to
              determine how the optimizer resolves a query.
            </p></li><li><p>
              Function names do not clash with table or column names.
              For example, <code class="literal">ABS</code> is a valid column
              name. The only restriction is that for a function call, no
              spaces are allowed between the function name and the
              ‘<code class="literal">(</code>’ that follows it. See
              <a href="language-structure.html#reserved-words" title="9.6. Treatment of Reserved Words in MySQL">Section 9.6, “Treatment of Reserved Words in MySQL”</a>.
            </p></li><li><p>
              You can mix tables from different databases in the same
              query (as of MySQL 3.22).
            </p></li></ul></div></li><li><p>
          Security
        </p><div class="itemizedlist"><ul type="circle"><li><p>
              A privilege and password system that is very flexible and
              secure, and that allows host-based verification. Passwords
              are secure because all password traffic is encrypted when
              you connect to a server.
            </p></li></ul></div></li><li><p>
          Scalability and Limits
        </p><div class="itemizedlist"><ul type="circle"><li><p>
              Handles large databases. We use MySQL Server with
              databases that contain 50 million records. We also know of
              users who use MySQL Server with 60,000 tables and about
              5,000,000,000 rows.
            </p></li><li><p>
              Up to 64 indexes per table are allowed (32 before MySQL
              4.1.2). Each index may consist of 1 to 16 columns or parts
              of columns. The maximum index width is 1000 bytes (500
              before MySQL 4.1.2). An index may use a prefix of a column
              for <code class="literal">CHAR</code>, <code class="literal">VARCHAR</code>,
              <code class="literal">BLOB</code>, or <code class="literal">TEXT</code> column
              types.
            </p></li></ul></div></li><li><p>
          Connectivity
        </p><div class="itemizedlist"><ul type="circle"><li><p>
              Clients can connect to the MySQL server using TCP/IP
              sockets on any platform. On Windows systems in the NT
              family (NT, 2000, XP, or 2003), clients can connect using
              named pipes. On Unix systems, clients can connect using
              Unix domain socket files.
            </p></li><li><p>
              In MySQL versions 4.1 and higher, Windows servers also
              support shared-memory connections if started with the
              <code class="option">--shared-memory</code> option. Clients can
              connect through shared memory by using the
              <code class="option">--protocol=memory</code> option.
            </p></li><li><p>
              The Connector/ODBC (MyODBC) interface provides MySQL
              support for client programs that use ODBC (Open Database
              Connectivity) connections. For example, you can use MS
              Access to connect to your MySQL server. Clients can be run
              on Windows or Unix. MyODBC source is available. All ODBC
              2.5 functions are supported, as are many others. See
              <a href="connectors.html" title="Chapter 23.   Connectors">Chapter 23, <i>  Connectors</i></a>.
            </p></li><li><p>
              The Connector/J interface provides MySQL support for Java
              client programs that use JDBC connections. Clients can be
              run on Windows or Unix. Connector/J source is available.
              See <a href="connectors.html" title="Chapter 23.   Connectors">Chapter 23, <i>  Connectors</i></a>.
            </p></li></ul></div></li><li><p>
          Localization
        </p><div class="itemizedlist"><ul type="circle"><li><p>
              The server can provide error messages to clients in many
              languages. See <a href="database-administration.html#languages" title="5.10.2. Setting the Error Message Language">Section 5.10.2, “Setting the Error Message Language”</a>.
            </p></li><li><p>
              Full support for several different character sets,
              including <code class="literal">latin1</code> (cp1252),
              <code class="literal">german</code>, <code class="literal">big5</code>,
              <code class="literal">ujis</code>, and more. For example, the
              Scandinavian characters
              ‘<code class="literal">å</code>’,
              ‘<code class="literal">ä</code>’ and
              ‘<code class="literal">ö</code>’ are allowed in table
              and column names. Unicode support is available as of MySQL
              4.1.
            </p></li><li><p>
              All data is saved in the chosen character set. All
              comparisons for normal string columns are
              case-insensitive.
            </p></li><li><p>
              Sorting is done according to the chosen character set
              (using Swedish collation by default). It is possible to
              change this when the MySQL server is started. To see an
              example of very advanced sorting, look at the Czech
              sorting code. MySQL Server supports many different
              character sets that can be specified at compile time and
              runtime.
            </p></li></ul></div></li><li><p>
          Clients and Tools
        </p><div class="itemizedlist"><ul type="circle"><li><p>
              The MySQL server has built-in support for SQL statements
              to check, optimize, and repair tables. These statements
              are available from the command line through the
              <span><strong class="command">mysqlcheck</strong></span> client. MySQL also includes
              <span><strong class="command">myisamchk</strong></span>, a very fast command-line
              utility for performing these operations on
              <code class="literal">MyISAM</code> tables. See
              <a href="database-administration.html" title="Chapter 5. Database Administration">Chapter 5, <i>Database Administration</i></a>.
            </p></li><li><p>
              All MySQL programs can be invoked with the
              <code class="option">--help</code> or <code class="option">-?</code> options to
              obtain online assistance.
            </p></li></ul></div></li></ul></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="stability"></a>1.4.3. MySQL Stability</h3></div></div></div><a class="indexterm" name="id2758855"></a><p>
      This section addresses the questions, “<span class="quote"><span class="emphasis"><em>How stable
      is MySQL Server?</em></span></span>” and, “<span class="quote"><span class="emphasis"><em>Can I
      depend on MySQL Server in this project?</em></span></span>” We will
      try to clarify these issues and answer some important questions
      that concern many potential users. The information in this section
      is based on data gathered from the mailing lists, which are very
      active in identifying problems as well as reporting types of use.
    </p><p>
      The original code stems back to the early 1980s. It provides a
      stable code base, and the <code class="literal">ISAM</code> table format
      used by the original storage engine remains backward-compatible.
      At TcX, the predecessor of MySQL AB, MySQL code has worked in
      projects since mid-1996, without any problems. When the MySQL
      Database Software initially was released to a wider public, our
      new users quickly found some pieces of untested code. Each new
      release since then has had fewer portability problems, even though
      each new release has also had many new features.
    </p><p>
      Each release of the MySQL Server has been usable. Problems have
      occurred only when users try code from the “<span class="quote">gray
      zones.</span>” Naturally, new users don't know what the gray zones
      are; this section therefore attempts to document those areas that
      are currently known. The descriptions mostly deal with Versions
      3.23 and later of MySQL Server. All known and reported bugs are
      fixed in the latest version, with the exception of those listed in
      the bugs section, which are design-related. See
      <a href="problems.html#bugs" title="A.8. Known Issues in MySQL">Section A.8, “Known Issues in MySQL”</a>.
    </p><p>
      The MySQL Server design is multi-layered with independent modules.
      Some of the newer modules are listed here with an indication of
      how well-tested each of them is:
    </p><a class="indexterm" name="id2758935"></a><div class="itemizedlist"><ul type="disc"><li><p>
          Replication (Stable)
        </p><p>
          Large groups of servers using replication are in production
          use, with good results. Work on enhanced replication features
          is continuing in MySQL 5.x.
        </p></li><li><p>
          <code class="literal">InnoDB</code> tables (Stable)
        </p><p>
          The <code class="literal">InnoDB</code> transactional storage engine has
          been stable since version 3.23.49. <code class="literal">InnoDB</code>
          is being used in large, heavy-load production systems.
        </p></li><li><p>
          <code class="literal">BDB</code> tables (Stable)
        </p><p>
          The <code class="literal">Berkeley DB</code> code is very stable, but we
          are still improving the <code class="literal">BDB</code> transactional
          storage engine interface in MySQL Server.
        </p></li><li><p>
          Full-text searches (Stable)
        </p><p>
          Full-text searching is widely used. Important feature
          enhancements were added in MySQL 4.0 and 4.1.
        </p></li><li><p>
          <code class="literal">MyODBC</code> 3.51 (Stable)
        </p><p>
          <code class="literal">MyODBC</code> 3.51 uses ODBC SDK 3.51 and is in
          wide production use. Some issues brought up appear to be
          application-related and independent of the ODBC driver or
          underlying database server.
        </p></li></ul></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="table-size"></a>1.4.4. How Big MySQL Tables Can Be</h3></div></div></div><a class="indexterm" name="id2759056"></a><a class="indexterm" name="id2759069"></a><a class="indexterm" name="id2759078"></a><a class="indexterm" name="id2759091"></a><a class="indexterm" name="id2759103"></a><p>
      MySQL 3.22 had a 4GB (4 gigabyte) limit on table size. With the
      <code class="literal">MyISAM</code> storage engine in MySQL 3.23, the
      maximum table size was increased to 65536 terabytes
      (256<sup>7</sup> – 1 bytes). With this
      larger allowed table size, the maximum effective table size for
      MySQL databases is usually determined by operating system
      constraints on file sizes, not by MySQL internal limits.
    </p><p>
      The <code class="literal">InnoDB</code> storage engine maintains
      <code class="literal">InnoDB</code> tables within a tablespace that can be
      created from several files. This allows a table to exceed the
      maximum individual file size. The tablespace can include raw disk
      partitions, which allows extremely large tables. The maximum
      tablespace size is 64TB.
    </p><p>
      The following table lists some examples of operating system
      file-size limits. This is only a rough guide and is not intended
      to be definitive. For the most up-to-date information, be sure to
      check the documentation specific to your operating system.
    </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td><span class="bold"><strong>Operating System</strong></span></td><td><span class="bold"><strong>File-size Limit</strong></span></td></tr><tr><td>Linux 2.2-Intel 32-bit</td><td>2GB (LFS: 4GB)</td></tr><tr><td>Linux 2.4+</td><td>(using ext3 filesystem) 4TB</td></tr><tr><td>Solaris 9/10</td><td>16TB</td></tr><tr><td>NetWare w/NSS filesystem</td><td>8TB</td></tr><tr><td>win32 w/ FAT/FAT32</td><td>2GB/4GB</td></tr><tr><td>win32 w/ NTFS</td><td>2TB (possibly larger)</td></tr><tr><td>MacOS X w/ HFS+</td><td>2TB</td></tr></tbody></table></div><p>
      On Linux 2.2, you can get <code class="literal">MyISAM</code> tables larger
      than 2GB in size by using the Large File Support (LFS) patch for
      the ext2 filesystem. On Linux 2.4, patches also exist for ReiserFS
      to get support for big files (up to 2TB). Most current Linux
      distributions are based on kernel 2.4 and include all the required
      LFS patches. With JFS and XFS, petabyte and larger files are
      possible on Linux. However, the maximum available file size still
      depends on several factors, one of them being the filesystem used
      to store MySQL tables.
    </p><p>
      For a detailed overview about LFS in Linux, have a look at Andreas
      Jaeger's <em class="citetitle">Large File Support in Linux</em> page
      at <a href="http://www.suse.de/~aj/linux_lfs.html" target="_top">http://www.suse.de/~aj/linux_lfs.html</a>.
    </p><p>
      Windows users please note: FAT and VFAT (FAT32) are
      <span class="emphasis"><em>not</em></span> considered suitable for production use
      with MySQL. Use NTFS instead.
    </p><p>
      By default, MySQL creates <code class="literal">MyISAM</code> tables with an
      internal structure that allows a maximum size of about 4GB. You
      can check the maximum table size for a table with the
      <code class="literal">SHOW TABLE STATUS</code> statement or with
      <span><strong class="command">myisamchk -dv
      <em class="replaceable"><code>tbl_name</code></em></strong></span>. See
      <a href="sql-syntax.html#show" title="13.5.4. SHOW Syntax">Section 13.5.4, “<code class="literal">SHOW</code> Syntax”</a>.
    </p><p>
      If you need a <code class="literal">MyISAM</code> table that is larger than
      4GB in size (and your operating system supports large files), the
      <code class="literal">CREATE TABLE</code> statement allows
      <code class="literal">AVG_ROW_LENGTH</code> and <code class="literal">MAX_ROWS</code>
      options. See <a href="sql-syntax.html#create-table" title="13.1.5. CREATE TABLE Syntax">Section 13.1.5, “<code class="literal">CREATE TABLE</code> Syntax”</a>. You can also change
      these options with <code class="literal">ALTER TABLE</code> after the table
      has been created, to increase the table's maximum allowable size.
      See <a href="sql-syntax.html#alter-table" title="13.1.2. ALTER TABLE Syntax">Section 13.1.2, “<code class="literal">ALTER TABLE</code> Syntax”</a>.
    </p><p>
      Other ways to work around file-size limits for
      <code class="literal">MyISAM</code> tables are as follows:
    </p><div class="itemizedlist"><ul type="disc"><li><p>
          If your large table is read-only, you can use
          <span><strong class="command">myisampack</strong></span> to compress it.
          <span><strong class="command">myisampack</strong></span> usually compresses a table by at
          least 50%, so you can have, in effect, much bigger tables.
          <span><strong class="command">myisampack</strong></span> also can merge multiple tables
          into a single table. See <a href="client-side-scripts.html#myisampack" title="8.2. myisampack — Generate Compressed, Read-Only MyISAM Tables">Section 8.2, “myisampack — Generate Compressed, Read-Only MyISAM Tables”</a>.
        </p></li><li><p>
          MySQL includes a <code class="literal">MERGE</code> library that allows
          you to handle a collection of <code class="literal">MyISAM</code> tables
          that have identical structure as a single
          <code class="literal">MERGE</code> table. See
          <a href="storage-engines.html#merge-storage-engine" title="14.3. The MERGE Storage Engine">Section 14.3, “The <code class="literal">MERGE</code> Storage Engine”</a>.
        </p></li></ul></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="year-2000-compliance"></a>1.4.5. Year 2000 Compliance</h3></div></div></div><a class="indexterm" name="id2759454"></a><a class="indexterm" name="id2759464"></a><a class="indexterm" name="id2759476"></a><p>
      The MySQL Server itself has no problems with Year 2000 (Y2K)
      compliance:
    </p><div class="itemizedlist"><ul type="disc"><li><p>
          MySQL Server uses Unix time functions that handle dates into
          the year <code class="literal">2037</code> for
          <code class="literal">TIMESTAMP</code> values. For
          <code class="literal">DATE</code> and <code class="literal">DATETIME</code>
          values, dates through the year <code class="literal">9999</code> are
          accepted.
        </p></li><li><p>
          All MySQL date functions are implemented in one source file,
          <code class="filename">sql/time.cc</code>, and are coded very carefully
          to be year 2000-safe.
        </p></li><li><p>
          In MySQL 3.22 and later, the <code class="literal">YEAR</code> column
          type can store the years <code class="literal">0</code> and
          <code class="literal">1901</code> to <code class="literal">2155</code> in one byte
          and display them using two or four digits. All two-digit years
          are considered to be in the range <code class="literal">1970</code> to
          <code class="literal">2069</code>, which means that if you store
          <code class="literal">01</code> in a <code class="literal">YEAR</code> column,
          MySQL Server treats it as <code class="literal">2001</code>.
        </p></li></ul></div><p>
      The following simple demonstration illustrates that MySQL Server
      has no problems with <code class="literal">DATE</code> or
      <code class="literal">DATETIME</code> values through the year 9999, and no
      problems with <code class="literal">TIMESTAMP</code> values until after the
      year 2030:
    </p><pre class="programlisting">mysql&gt; <strong class="userinput"><code>DROP TABLE IF EXISTS y2k;</code></strong>
Query OK, 0 rows affected (0.01 sec)

mysql&gt; <strong class="userinput"><code>CREATE TABLE y2k (date DATE,</code></strong>
    -&gt;                   <strong class="userinput"><code>date_time DATETIME,</code></strong>
    -&gt;                   <strong class="userinput"><code>time_stamp TIMESTAMP);</code></strong>
Query OK, 0 rows affected (0.01 sec)

mysql&gt; <strong class="userinput"><code>INSERT INTO y2k VALUES</code></strong>
    -&gt; <strong class="userinput"><code>('1998-12-31','1998-12-31 23:59:59',19981231235959),</code></strong>
    -&gt; <strong class="userinput"><code>('1999-01-01','1999-01-01 00:00:00',19990101000000),</code></strong>
    -&gt; <strong class="userinput"><code>('1999-09-09','1999-09-09 23:59:59',19990909235959),</code></strong>
    -&gt; <strong class="userinput"><code>('2000-01-01','2000-01-01 00:00:00',20000101000000),</code></strong>
    -&gt; <strong class="userinput"><code>('2000-02-28','2000-02-28 00:00:00',20000228000000),</code></strong>
    -&gt; <strong class="userinput"><code>('2000-02-29','2000-02-29 00:00:00',20000229000000),</code></strong>
    -&gt; <strong class="userinput"><code>('2000-03-01','2000-03-01 00:00:00',20000301000000),</code></strong>
    -&gt; <strong class="userinput"><code>('2000-12-31','2000-12-31 23:59:59',20001231235959),</code></strong>
    -&gt; <strong class="userinput"><code>('2001-01-01','2001-01-01 00:00:00',20010101000000),</code></strong>
    -&gt; <strong class="userinput"><code>('2004-12-31','2004-12-31 23:59:59',20041231235959),</code></strong>
    -&gt; <strong class="userinput"><code>('2005-01-01','2005-01-01 00:00:00',20050101000000),</code></strong>
    -&gt; <strong class="userinput"><code>('2030-01-01','2030-01-01 00:00:00',20300101000000),</code></strong>
    -&gt; <strong class="userinput"><code>('2040-01-01','2040-01-01 00:00:00',20400101000000),</code></strong>
    -&gt; <strong class="userinput"><code>('9999-12-31','9999-12-31 23:59:59',99991231235959);</code></strong>
Query OK, 14 rows affected (0.01 sec)
Records: 14  Duplicates: 0  Warnings: 2

mysql&gt; <strong class="userinput"><code>SELECT * FROM y2k;</code></strong>
+------------+---------------------+----------------+
| date       | date_time           | time_stamp     |
+------------+---------------------+----------------+
| 1998-12-31 | 1998-12-31 23:59:59 | 19981231235959 |
| 1999-01-01 | 1999-01-01 00:00:00 | 19990101000000 |
| 1999-09-09 | 1999-09-09 23:59:59 | 19990909235959 |
| 2000-01-01 | 2000-01-01 00:00:00 | 20000101000000 |
| 2000-02-28 | 2000-02-28 00:00:00 | 20000228000000 |
| 2000-02-29 | 2000-02-29 00:00:00 | 20000229000000 |
| 2000-03-01 | 2000-03-01 00:00:00 | 20000301000000 |
| 2000-12-31 | 2000-12-31 23:59:59 | 20001231235959 |
| 2001-01-01 | 2001-01-01 00:00:00 | 20010101000000 |
| 2004-12-31 | 2004-12-31 23:59:59 | 20041231235959 |
| 2005-01-01 | 2005-01-01 00:00:00 | 20050101000000 |
| 2030-01-01 | 2030-01-01 00:00:00 | 20300101000000 |
| 2040-01-01 | 2040-01-01 00:00:00 | 00000000000000 |
| 9999-12-31 | 9999-12-31 23:59:59 | 00000000000000 |
+------------+---------------------+----------------+
14 rows in set (0.00 sec)
</pre><p>
      The final two <code class="literal">TIMESTAMP</code> column values are zero
      because the year values (<code class="literal">2040</code>,
      <code class="literal">9999</code>) exceed the <code class="literal">TIMESTAMP</code>
      maximum. The <code class="literal">TIMESTAMP</code> data type, which is used
      to store the current time, supports values that range from
      <code class="literal">19700101000000</code> to
      <code class="literal">20300101000000</code> on 32-bit machines (signed
      value). On 64-bit machines, <code class="literal">TIMESTAMP</code> handles
      values up to <code class="literal">2106</code> (unsigned value).
    </p><p>
      Although MySQL Server itself is Y2K-safe, you may run into
      problems if you use it with applications that are not Y2K-safe.
      For example, many old applications store or manipulate years using
      two-digit values (which are ambiguous) rather than four-digit
      values. This problem may be compounded by applications that use
      values such as <code class="literal">00</code> or <code class="literal">99</code> as
      “<span class="quote">missing</span>” value indicators. Unfortunately, these
      problems may be difficult to fix because different applications
      may be written by different programmers, each of whom may use a
      different set of conventions and date-handling functions.
    </p><p>
      Thus, even though MySQL Server has no Y2K problems, <span class="emphasis"><em>it
      is the application's responsibility to provide unambiguous
      input</em></span>. See <a href="column-types.html#y2k-issues" title="11.3.4. Y2K Issues and Date Types">Section 11.3.4, “Y2K Issues and Date Types”</a> for MySQL
      Server's rules for dealing with ambiguous date input data that
      contains two-digit year values.
    </p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="maxdb"></a>1.5. Overview of the MaxDB Database Management System</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="introduction.html#maxdb-overview">1.5.1. What is MaxDB?</a></span></dt><dt><span class="section"><a href="introduction.html#maxdb-history">1.5.2. History of MaxDB</a></span></dt><dt><span class="section"><a href="introduction.html#maxdb-features">1.5.3. Features of MaxDB</a></span></dt><dt><span class="section"><a href="introduction.html#maxdb-licensing">1.5.4. Licensing and Support</a></span></dt><dt><span class="section"><a href="introduction.html#maxdb-mysql-differences">1.5.5. Feature Differences Between MaxDB and MySQL</a></span></dt><dt><span class="section"><a href="introduction.html#maxdb-mysql-interoperability">1.5.6. Interoperability Features Between MaxDB and MySQL</a></span></dt><dt><span class="section"><a href="introduction.html#maxdb-links">1.5.7. MaxDB-Related Links</a></span></dt></dl></div><p>
    MaxDB is a heavy-duty enterprise database. The database management
    system is SAP-certified.
  </p><p>
    MaxDB is the new name of a database management system formerly
    called SAP DB. In 2003 SAP AG and MySQL AB joined a partnership and
    re-branded the database system to MaxDB. The development of MaxDB
    has continued since then as it was done before – through the SAP
    developer team.
  </p><p>
    MySQL AB co-operates closely with the MaxDB team at SAP around
    delivering improvements to the MaxDB product. Joint efforts include
    development of new native drivers to enable more efficient usage of
    MaxDB in the Open Source community, and improvement of various
    documentation to expand the MaxDB user base. Also interoperability
    features between MySQL and MaxDB database are seen as important, and
    for instance the new MaxDB Synchronization Manager supports data
    synchronization from MaxDB to MySQL.
  </p><p>
    The MaxDB database management system does not share a common
    code-base with the MySQL database management system. The MaxDB and
    MySQL database management systems are independent products provided
    by MySQL AB.
  </p><p>
    MySQL AB offers a complete portfolio of Professional Services for
    MaxDB.
  </p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="maxdb-overview"></a>1.5.1. What is MaxDB?</h3></div></div></div><p>
      MaxDB is a ANSI SQL-92 (entry level) compliant relational database
      management system (RDBMS) from SAP AG, that is delivered by MySQL
      AB as well. MaxDB fulfills the needs for enterprise usage: safety,
      scalability high concurrency and performance . It runs on all
      major operating systems. Over the years it has proven able to run
      SAP R/3 and terabytes of data in 24x7 operation.
    </p><p>
      The database development started in 1977 as a research project at
      the Technical University of Berlin . In the early 80s it became a
      database product that subsequently was owned by Nixdorf, Siemens
      Nixdorf, Software AG and today – by SAP AG. Along this line it
      has been named VDN, Reflex, Supra 2, DDB/4, Entire SQL-DB-Server
      and ADABAS D. In 1997 SAP took over the software from software AG
      and renamed it to SAP DB. Since October 2000 SAP DB sources
      additionally were released as open source under the GNU General
      Public License (see <a href="gpl-license.html" title="Appendix J. GNU General Public License">Appendix J, <i>GNU General Public License</i></a>).
    </p><p>
      In 2003 SAP AG and MySQL AB joined a partnership and re-branded
      the database system to MaxDB.
    </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="maxdb-history"></a>1.5.2. History of MaxDB</h3></div></div></div><p>
      The history of MaxDB goes back to SAP DB, SAP AG's DBMS, i.e.
      MaxDB is a re-branded and enhanced version of SAP DB. For many
      years, MaxDB has been used for small, medium, and large
      installations of the mySAP Business Suite and other demanding SQL
      applications requiring an enterprise-class DBMS with regard to the
      number of users, the transactional workload, and the size of the
      database.
    </p><p>
      SAP DB was meant to provide an alternative to third-party database
      systems such as Oracle, Microsoft SQL Server, and DB2 by IBM. In
      October 2000, SAP AG released SAP DB under the GNU GPL license
      (see <a href="gpl-license.html" title="Appendix J. GNU General Public License">Appendix J, <i>GNU General Public License</i></a>), thus making it open source
      software.
    </p><p>
      Today, MaxDB is used in about 3,500 SAP customer installations
      worldwide. Moreover, the majority of all DBMS installations on
      Unix and Linux within SAP’s IT department rely on MaxDB. MaxDB
      is tuned towards heavy-duty online transaction processing (OLTP)
      with several thousand users and database sizes ranging from
      several hundred GB to multiple TB.
    </p><p>
      In 2003 SAP and MySQL concluded a partnership and development
      cooperation agreement. As a result, SAP's database system SAP DB
      has been delivered under the name of MaxDB by MySQL since the
      release of version 7.5 (November 2003).
    </p><p>
      Version 7.5 of MaxDB is a direct advancement of the SAP DB 7.4
      code base. Therefore, the MaxDB software version 7.5 can be used
      as a direct upgrade of previous SAP DB versions starting 7.2.04
      and higher.
    </p><p>
      Now, as before, the former SAP DB development team at SAP AG is
      responsible for developing and supporting MaxDB. MySQL AB
      co-operates closely with the MaxDB team at SAP around delivering
      improvements to the MaxDB product, see <a href="introduction.html#maxdb" title="1.5. Overview of the MaxDB Database Management System">Section 1.5, “Overview of the MaxDB Database Management System”</a>.
      Both SAP AG and MySQL AB handle the sale and distribution of
      MaxDB. The advancement of MaxDB and the MySQL Server leverages
      synergies that benefit both product lines.
    </p><p>
      MaxDB is subjected to SAP AG's complete quality assurance process
      before it is shipped with SAP solutions or provided as a download
      from the MySQL site.
    </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="maxdb-features"></a>1.5.3. Features of MaxDB</h3></div></div></div><p>
      MaxDB is a heavy-duty, SAP-certified open source database for OLTP
      and OLAP usage which offers high reliability, availability,
      scalability and a very comprehensive feature set. It is targeted
      for large mySAP Business Suite environments and other applications
      that require maximum enterprise-level database functionality and
      complements the MySQL database server.
    </p><p>
      MaxDB operates as a client/server product. It was developed to
      meet the needs of installations in OLTP and Data
      Warehouse/OLAP/Decision Support scenarios.
      <span class="bold"><strong>Benefits:</strong></span>

      </p><div class="itemizedlist"><ul type="disc"><li><p>
            <span class="bold"><strong>Easy configuration and
            administration:</strong></span> GUI-based Installation Manager
            and Database Manager as single administration tools for DBMS
            operations
          </p></li><li><p>
            <span class="bold"><strong>Around-the-clock operation, no planned
            downtimes, no permanent attendance required:</strong></span>
            Automatic space management, no need for reorganizations
          </p></li><li><p>
            <span class="bold"><strong>Elaborate backup and restore
            capabilities:</strong></span> Online and incremental backups,
            recovery wizard to guide you through the recovery scenario
          </p></li><li><p>
            <span class="bold"><strong>Supports large number of users,
            database sizes in the terabytes, and demanding
            workloads:</strong></span> Proven reliability, performance, and
            scalability
          </p></li><li><p>
            <span class="bold"><strong>High availability:</strong></span> Cluster
            support, standby configuration, hot standby configuration
          </p></li></ul></div><p>
    </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="maxdb-licensing"></a>1.5.4. Licensing and Support</h3></div></div></div><p>
      MaxDB can be used under the same licenses available for the other
      products distributed by MySQL AB. Thus, MaxDB is available under
      the GNU General Public License, and a commercial license. For more
      information on licensing, see
      <a href="http://www.mysql.com/company/legal/licensing/" target="_top">http://www.mysql.com/company/legal/licensing/</a>.
    </p><p>
      MySQL AB offers MaxDB technical support to non-SAP customers. The
      MaxDB support is available on various levels (Basic, Silver and
      Gold), which expand from unlimited email/web-support to 24x7 phone
      support for business critical systems.
    </p><p>
      MySQL AB also offers Licenses and Support for MaxDB when used with
      SAP Applications, like SAP NetWeaver and mySAP Business Suite.
      <a href="http://www.mysql.com/company/contact/" target="_top">Please
      contact</a> MySQL AB for more information on licenses and
      support for your needs.
    </p><p>
      Consulting and training services are available. MySQL gives
      classes on MaxDB in regular intervals, see
      <a href="http://www.mysql.com/training/" target="_top">http://www.mysql.com/training/</a> for a list of
      classes.
    </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="maxdb-mysql-differences"></a>1.5.5. Feature Differences Between MaxDB and MySQL</h3></div></div></div><p>
      MaxDB is MySQL AB's SAP-certified database. The MaxDB database
      server complements the MySQL AB product portfolio. Some MaxDB
      features are not available on the MySQL database management server
      and vice versa.
    </p><p>
      The following list provides a short summary of the main
      differences between MaxDB and MySQL; it is not complete.
    </p><div class="itemizedlist"><ul type="disc"><li><p>
          MaxDB runs as a client/server system. MySQL can run as a
          client/server system or as an embedded system.
        </p></li><li><p>
          MaxDB might not run on all platforms supported by MySQL.
        </p></li><li><p>
          MaxDB uses a proprietary network protocol for client/server
          communication. MySQL uses either TCP/IP (with or without SSL
          encryption), sockets (under Unix-like systems), or named pipes
          (under Windows NT-family systems).
        </p></li><li><p>
          MaxDB supports stored procedures. For MySQL, stored procedures
          are implemented in version 5.0. MaxDB also supports
          programming of triggers through an SQL extension, which is
          scheduled for MySQL 5.1. MaxDB contains a debugger for stored
          procedure languages, can cascade nested triggers, and supports
          multiple triggers per action and row.
        </p></li><li><p>
          MaxDB is distributed with user interfaces that are text-based,
          graphical, or Web-based. MySQL is distributed with text-based
          user interfaces only; graphical user interface (MySQL Control
          Center, MySQL Administrator) are shipped separately from the
          main distributions. Web-based user interfaces for MySQL are
          offered by third parties.
        </p></li><li><p>
          MaxDB supports a number of programming interfaces that also
          are supported by MySQL. For developing with MaxDB, the MaxDB
          ODBC Driver, SQL Database Connectivity (SQLDBC), JDBC Driver,
          Perl and Python modules and a MaxDB PHP extension, which
          provides access to the MySQL MaxDB databases using PHP, are
          available. Third Party Programming Interfaces: Support for OLE
          DB, ADO, DAO, RDO and .NET through ODBC. MaxDB supports
          embedded SQL with C/C++.
        </p></li><li><p>
          MaxDB includes administrative features that MySQL does not
          have: job scheduling by time, event, and alert, and sending
          messages to a database administrator on alert thresholds.
        </p></li></ul></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="maxdb-mysql-interoperability"></a>1.5.6. Interoperability Features Between MaxDB and MySQL</h3></div></div></div><p>
      MaxDB and MySQL are independent database management servers. The
      interoperation of the systems is possible in a way that the
      systems can exchange their data. To exchange data between MaxDB
      and MySQL you can use the import and export tools of the systems
      or the MaxDB Synchronization Manager. The import and export tools
      can be used to transfer data in a in-frequently, manual fashion.
      The MaxDB Synchronization Manager offers faster, automatic data
      transfer capabilities.
    </p><p>
      The MaxDB Loader can be used to export data and object
      definitions. The Loader can export data using MaxDB internal,
      binary formats and text formats (CSV). Data exported from MaxDB in
      text formats can be re-imported to MySQL using the
      <span><strong class="command">mysqldump</strong></span> database backup program. In order to
      import MySQL data into MaxDB you can either use
      <span><strong class="command">mysqldump</strong></span> to create <code class="literal">INSERT</code>
      statements or <code class="literal">SELECT ... INTO OUTFILE</code> to create
      a text file (CSV). Use the MaxDB Loader to load the data files
      generated by MySQL.
    </p><p>
      Object definitions can be exchanged between the systems using
      MaxDB Loader and the MySQL tool <span><strong class="command">mysqldump</strong></span>. As
      the SQL dialects of both systems differ slightly and MaxDB has
      features currently not supported by MySQL like SQL constraints, we
      recommend to hand-tune the definition files. The
      <span><strong class="command">mysqldump</strong></span> tool offers an option
      <code class="literal">--compatible-name = maxdb</code> to produce output
      that is compatible to MaxDB to make porting easier.
    </p><p>
      As part of MaxDB 7.6, the MaxDB Synchronization Manager is
      released. The Synchronization Manager supports creation of
      asynchronous replication scenarios between several MaxDB
      instances. However, interoperability features also are planned, so
      that the Synchronization Manager supports replication to and from
      a MySQL server.
    </p><p>
      In the first release, the Synchronization Manager supports
      inserting data into MySQL. This means that initially only
      replication from MaxDB to MySQL is supported. In the course of
      2005, exporting of data from a MySQL server to the Synchronization
      Manager will be added, thus adding support for MySQL to MaxDB
      replication scenarios.
    </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="maxdb-links"></a>1.5.7. MaxDB-Related Links</h3></div></div></div><p>
      The main page for information about MaxDB is
      <a href="http://www.mysql.com/products/maxdb" target="_top">http://www.mysql.com/products/maxdb</a>. The page gives
      details about the features of the MaxDB database management
      systems and has pointers to documentation available.
    </p><p>
      The MySQL Reference Manual does not contain any MaxDB
      documentation but the introduction given in this section. MaxDB
      has it's own documentation, called the MaxDB library. The MaxDB
      library is available on
      <a href="http://dev.mysql.com/doc/maxdb/index.html" target="_top">http://dev.mysql.com/doc/maxdb/index.html</a>.
    </p><p>
      MySQL AB runs a community mailing list on MaxDB, see
      <a href="http://lists.mysql.com/maxdb" target="_top">http://lists.mysql.com/maxdb</a>. The list shows a
      vivid community discussion. Many of the core developers contribute
      to it. Product announcements are send to list.
    </p><p>
      A web forum on MaxDB is on
      <a href="http://forums.mysql.com/" target="_top">http://forums.mysql.com/</a>. The forum is for
      questions on MaxDB not related to SAP application.
    </p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="roadmap"></a>1.6. MySQL Development Roadmap</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="introduction.html#mysql-5-0-nutshell">1.6.1. What's New in MySQL 5.0</a></span></dt></dl></div><p>
      This section provides a snapshot of the MySQL development roadmap,
      including major features implemented in or planned for the various
      MySQL releases. The following sections provide information for
      each release series.
    </p><p>
      The current production release series is MySQL 5.0, which was
      declared stable for production use as of Version 5.0.15, released
      in October 2005. The previous production release series was MySQL
      4.1, which was declared stable for production use as of Version
      4.1.7, released in October 2004. “<span class="quote">Production status</span>”
      means that future 5.0 and 4.1 development is limited only to
      bugfixes. For the older MySQL 4.0 and 3.23 series, only critical
      bugfixes are made.
    </p><p>
      Active MySQL development is currently taking place in the MySQL
      5.0 and 5.1 release series, and new features are being added only
      to the latter.
    </p><p>
      Before upgrading from one release series to the next, please see
      the notes at <a href="installing.html#upgrade" title="2.10. Upgrading MySQL">Section 2.10, “Upgrading MySQL”</a>.
    </p><p>
      The most requested features and the versions in which they were
      implemented or are scheduled for implementation are summarized in
      the following table:
    </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td><span class="bold"><strong>Feature</strong></span></td><td><span class="bold"><strong>MySQL Series</strong></span></td></tr><tr><td>Foreign keys</td><td>3.23 (for the <code class="literal">InnoDB</code> storage engine)</td></tr><tr><td>Unions</td><td>4.0</td></tr><tr><td>Subqueries</td><td>4.1</td></tr><tr><td>R-trees</td><td>4.1 (for the <code class="literal">MyISAM</code> storage engine)</td></tr><tr><td>Stored procedures</td><td>5.0</td></tr><tr><td>Views</td><td>5.0</td></tr><tr><td>Cursors</td><td>5.0</td></tr><tr><td>XA transactions</td><td>5.0</td></tr><tr><td>Foreign keys</td><td>5.1 (implemented in 3.23 for <code class="literal">InnoDB</code>)</td></tr><tr><td>Triggers</td><td>5.0 and 5.1</td></tr><tr><td>Full outer joins</td><td>5.1</td></tr><tr><td>Constraints</td><td>5.1 (implemented in 3.23 for <code class="literal">InnoDB</code>)</td></tr><tr><td>Partitioning</td><td>5.1</td></tr><tr><td>Pluggable Storage Engine API</td><td>5.1</td></tr><tr><td>Row-Based Replication</td><td>5.1</td></tr></tbody></table></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="mysql-5-0-nutshell"></a>1.6.1. What's New in MySQL 5.0</h3></div></div></div><p>
        The following features are implemented in MySQL 5.0.
      </p><div class="itemizedlist"><ul type="disc"><li><p>
            <span class="bold"><strong><code class="literal">BIT</code> Data
            Type</strong></span>: Can be used to store numbers in binary
            notation. See <a href="column-types.html#numeric-type-overview" title="11.1.1. Overview of Numeric Types">Section 11.1.1, “Overview of Numeric Types”</a>.
          </p></li><li><p>
            <span class="bold"><strong>Cursors</strong></span>: Elementary support
            for server-side cursors. See <a href="stored-procedures.html#cursors" title="17.2.11. Cursors">Section 17.2.11, “Cursors”</a>.
          </p></li><li><p>
            <span class="bold"><strong>Information Schema</strong></span>: The
            introduction of the <code class="literal">INFORMATION_SCHEMA</code>
            database in MySQL 5.0 provided a standards-compliant means
            for accessing the MySQL Server's metadata, that is, data
            about the databases (schemas) on the server and the objects
            which they contain. See
            <a href="information-schema.html" title="Chapter 20. The INFORMATION_SCHEMA Information Database">Chapter 20, <i>The <code class="literal">INFORMATION_SCHEMA</code> Information Database</i></a>.
          </p></li><li><p>
            <span class="bold"><strong>Instance Manager</strong></span>: Can be
            used to start and stop the MySQL Server, even from a remote
            host. See <a href="database-administration.html#instance-manager" title="5.2. mysqlmanager — The MySQL Instance Manager">Section 5.2, “mysqlmanager — The MySQL Instance Manager”</a>.
          </p></li><li><p>
            <span class="bold"><strong>Precision Math</strong></span>: MySQL 5.0
            introduced stricter criteria for acceptance or rejection of
            data, and implemented a new library for fixed-point
            arithmetic. These contributed to a much higher degree of
            accuracy for mathematical operations and greater control
            over invalid values. See <a href="precision-math.html" title="Chapter 21. Precision Math">Chapter 21, <i>Precision Math</i></a>.
          </p></li><li><p>
            <span class="bold"><strong>Storage Engines</strong></span>: Storage
            engines added in MySQL 5.0 include
            <code class="literal">ARCHIVE</code> and <code class="literal">FEDERATED</code>.
            See <a href="storage-engines.html#archive-storage-engine" title="14.8. The ARCHIVE Storage Engine">Section 14.8, “The <code class="literal">ARCHIVE</code> Storage Engine”</a> and
            <a href="storage-engines.html#federated-storage-engine" title="14.7. The FEDERATED Storage Engine">Section 14.7, “The <code class="literal">FEDERATED</code> Storage Engine”</a>.
          </p></li><li><p>
            <span class="bold"><strong>Stored Routines</strong></span>: Support
            for named stored procedures and stored functions was
            implemented in MySQL 5.0. See
            <a href="stored-procedures.html" title="Chapter 17. Stored Procedures and Functions">Chapter 17, <i>Stored Procedures and Functions</i></a>.
          </p></li><li><p>
            <span class="bold"><strong>Strict Mode and Standard Error
            Handling</strong></span>: MySQL 5.0 added a strict mode where by
            it follows standard SQL in a number of ways in which it did
            not previously. Support for standard SQLSTATE error messages
            was also implemented. See <a href="database-administration.html#server-sql-mode" title="5.3.2. The Server SQL Mode">Section 5.3.2, “The Server SQL Mode”</a>.
          </p></li><li><p>
            <span class="bold"><strong>Triggers</strong></span>: MySQL 5.0 added
            limited support for triggers. See <a href="triggers.html" title="Chapter 18. Triggers">Chapter 18, <i>Triggers</i></a>
            and <a href="introduction.html#ansi-diff-triggers" title="1.8.5.4. Stored Procedures and Triggers">Section 1.8.5.4, “Stored Procedures and Triggers”</a>.
          </p></li><li><p>
            <span class="bold"><strong><code class="literal">VARCHAR</code> Data
            Type</strong></span>: The maximum effective length of a
            <code class="literal">VARCHAR</code> column was increased to 65,532
            bytes, and stripping of trailing whitespace was eliminated.
            See <a href="column-types.html#string-types" title="11.4. String Types">Section 11.4, “String Types”</a>.
          </p></li><li><p>
            <span class="bold"><strong>Views</strong></span>: MySQL 5.0 added
            support for named, updateable views. See
            <a href="views.html" title="Chapter 19. Views">Chapter 19, <i>Views</i></a> and
            <a href="introduction.html#ansi-diff-views" title="1.8.5.6. Views">Section 1.8.5.6, “Views”</a>.
          </p></li><li><p>
            <span class="bold"><strong>XA Transactions</strong></span>: See
            <a href="sql-syntax.html#xa" title="13.4.7. XA Transactions">Section 13.4.7, “XA Transactions”</a>.
          </p></li><li><p>
            <span class="bold"><strong>Performance enhancements</strong></span>: A
            number of improvements were made in MySQL 5.0 to improve the
            speed of certain types of queries and in the handling of
            certain types. These include:
          </p><div class="itemizedlist"><ul type="circle"><li><p>
                MySQL 5.0 introduces a new “<span class="quote">greedy</span>”
                optimizer which can greatly reduce the time required to
                arrive at a query execution plan. This is particularly
                noticeable where several tables are to be joined and no
                good join keys can otherwise be found. Without the
                greedy optimizer, the complexity of the search for an
                execution plan is calculated as
                <code class="literal"><em class="replaceable"><code>N</code></em>!</code>, where
                <em class="replaceable"><code>N</code></em> is the number of tables to
                be joined. The greedy optimizer reduces this to
                <code class="literal"><em class="replaceable"><code>N</code></em>!/(<em class="replaceable"><code>D</code></em>-1)!</code>,
                where <em class="replaceable"><code>D</code></em> is the depth of the
                search. While the greedy optimizer does not guarantee
                the best possible of all execution plans (this is
                currently being worked on), it can reduce the time spent
                arriving at an execution plan for a join involving a
                great many tables — 30, 40, or more — by a
                factor of as much as 1,000. This should eliminate most
                if not all situations where users thought that the
                optimizer had hung when trying to perform joins across
                many tables.
              </p></li><li><p>
                Use of the <em class="firstterm">Index Merge</em> method to
                obtain better optimization of <code class="literal">AND</code> and
                <code class="literal">OR</code> relations over different keys.
                (Previously, these were optimized only where both
                relations in the <code class="literal">WHERE</code> clause
                involved the same key.) This also applies to other
                one-to-one comparison operators
                (<code class="literal">&gt;</code>, <code class="literal">&lt;</code>, so
                on), including <code class="literal">=</code> and the
                <code class="literal">IN</code> operator. This means that MySQL
                can use multiple indexes in retrieving results for
                conditions such as <code class="literal">WHERE key1 &gt; 4 OR key2
                &lt; 7</code> and even combinations of conditions
                such as <code class="literal">WHERE (key1 &gt; 4 OR key2 &lt; 7) AND
                (key3 &gt;= 10 OR key4 = 1)</code>. See
                <a href="optimization.html#index-merge-optimization" title="7.2.6. Index Merge Optimization">Section 7.2.6, “Index Merge Optimization”</a>.
              </p></li><li><p>
                A new equality detector finds and optimizes
                “<span class="quote">hidden</span>” equalities in joins. For example,
                a <code class="literal">WHERE</code> clause such as
              </p><pre class="programlisting">t1.c1=t2c2 AND t2.c2=t3.c3 AND t1.c1 &lt; 5
</pre><p>
                can be reduced to
              </p><pre class="programlisting">t1.c1=t3.c3 AND t2.c2 &lt; 5 AND t3.c3 &lt; 5
</pre><p>
                These optimizations can be applied with any combination
                of <code class="literal">AND</code> and <code class="literal">OR</code>
                operators. See <a href="optimization.html#nested-joins" title="7.2.10. How MySQL Optimizes Nested Joins">Section 7.2.10, “How MySQL Optimizes Nested Joins”</a> and
                <a href="optimization.html#outer-join-simplification" title="7.2.11. How MySQL Simplifies Outer Joins">Section 7.2.11, “How MySQL Simplifies Outer Joins”</a>.
              </p></li><li><p>
                Optimization of <code class="literal">NOT IN</code> and
                <code class="literal">NOT BETWEEN</code> relations, reducing or
                eliminating table scans for queries making use of them
                by mean of range analysis. The performance of MySQL with
                regard to these relations now matches its performance
                with regard to <code class="literal">IN</code> and
                <code class="literal">BETWEEN</code>.
              </p></li><li><p>
                The <code class="literal">VARCHAR</code> data type as implemented
                in MySQL 5.0 is more efficient than in previous
                versions, due to the elimination of the old (and
                nonstandard) removal of trailing spaces during retrival.
              </p></li><li><p>
                The addition of a true <code class="literal">BIT</code> column
                type; this type is much more efficient for storage and
                retrieval of Boolean values than the workarounds
                required in MySQL in versions previous to 5.0.
              </p></li><li><p>
                <span class="bold"><strong>Performance Improvements in the
                <code class="literal">InnoDB</code> Storage Engine</strong></span>:
              </p><div class="itemizedlist"><ul type="square"><li><p>
                    New compact storage format which can save up to 20%
                    of the disk space required in previous
                    MySQL/<code class="literal">InnoDB</code> versions.
                  </p></li><li><p>
                    Faster recovery from a failed or aborted
                    <code class="literal">ALTER TABLE</code>.
                  </p></li><li><p>
                    Faster implementation of
                    <code class="literal">TRUNCATE</code>.
                  </p></li></ul></div><p>
                (See <a href="storage-engines.html#innodb" title="14.2. The InnoDB Storage Engine">Section 14.2, “The <code class="literal">InnoDB</code> Storage Engine”</a>.)
              </p></li><li><p>
                <span class="bold"><strong>Performance Improvements in the
                <code class="literal">NDBCluster</code> Storage Engine</strong></span>:
              </p><div class="itemizedlist"><ul type="square"><li><p>
                    Faster handling of queries that use
                    <code class="literal">IN</code> and
                    <code class="literal">BETWEEN</code>.
                  </p></li><li><p>
                    <span class="bold"><strong>Condition pushdown</strong></span>:
                    In cases involving the comparison of an unindexed
                    column with a constant, this condition is
                    “<span class="quote">pushed down</span>” to the cluster where it
                    is evaluated in all partitions simultaneously,
                    eliminating the need to send non-matching records
                    over the network. This can make such queries 10 to
                    100 times faster than in MySQL 4.1 Cluster.
                  </p></li></ul></div><p>
                (See <a href="ndbcluster.html" title="Chapter 15. MySQL Cluster">Chapter 15, <i>MySQL Cluster</i></a>.)
              </p></li></ul></div></li></ul></div><p>
        For those wishing to take a look at the bleeding edge of MySQL
        development, we make our BitKeeper repository for MySQL publicly
        available. See <a href="installing.html#installing-source-tree" title="2.8.3. Installing from the Development Source Tree">Section 2.8.3, “Installing from the Development Source Tree”</a>.
      </p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="mysql-information-sources"></a>1.7. MySQL Information Sources</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="introduction.html#questions">1.7.1. MySQL Mailing Lists</a></span></dt><dt><span class="section"><a href="introduction.html#irc">1.7.2. MySQL Community Support on IRC (Internet Relay Chat)</a></span></dt><dt><span class="section"><a href="introduction.html#forums">1.7.3. MySQL Community Support at the MySQL Forums</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="questions"></a>1.7.1. MySQL Mailing Lists</h3></div></div></div><div class="toc"><dl><dt><span class="section"><a href="introduction.html#mailing-list">1.7.1.1. The MySQL Mailing Lists</a></span></dt><dt><span class="section"><a href="introduction.html#asking-questions">1.7.1.2. Asking Questions or Reporting Bugs</a></span></dt><dt><span class="section"><a href="introduction.html#bug-reports">1.7.1.3. How to Report Bugs or Problems</a></span></dt><dt><span class="section"><a href="introduction.html#answering-questions">1.7.1.4. Guidelines for Answering Questions on the Mailing List</a></span></dt></dl></div><a class="indexterm" name="id2761429"></a><a class="indexterm" name="id2761441"></a><a class="indexterm" name="id2761454"></a><p>
      This section introduces the MySQL mailing lists and provides
      guidelines as to how the lists should be used. When you subscribe
      to a mailing list, you receive all postings to the list as email
      messages. You can also send your own questions and answers to the
      list.
    </p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="mailing-list"></a>1.7.1.1. The MySQL Mailing Lists</h4></div></div></div><a class="indexterm" name="id2761482"></a><a class="indexterm" name="id2761491"></a><p>
        To subscribe to or unsubscribe from any of the mailing lists
        described in this section, visit
        <a href="http://lists.mysql.com/" target="_top">http://lists.mysql.com/</a>. For most of them, you
        can select the regular version of the list where you get
        individual messages, or a digest version where you get one large
        message per day.
      </p><p>
        Please <span class="emphasis"><em>do not</em></span> send messages about
        subscribing or unsubscribing to any of the mailing lists,
        because such messages are distributed automatically to thousands
        of other users.
      </p><p>
        Your local site may have many subscribers to a MySQL mailing
        list. If so, the site may have a local mailing list, so that
        messages sent from <code class="literal">lists.mysql.com</code> to your
        site are propagated to the local list. In such cases, please
        contact your system administrator to be added to or dropped from
        the local MySQL list.
      </p><p>
        If you wish to have traffic for a mailing list go to a separate
        mailbox in your mail program, set up a filter based on the
        message headers. You can use either the
        <code class="literal">List-ID:</code> or <code class="literal">Delivered-To:</code>
        headers to identify list messages.
      </p><p>
        The MySQL mailing lists are as follows:
      </p><div class="itemizedlist"><ul type="disc"><li><p>
            <code class="literal">announce</code>
          </p><p>
            This list is for announcements of new versions of MySQL and
            related programs. This is a low-volume list to which all
            MySQL users should subscribe.
          </p></li><li><p>
            <code class="literal">mysql</code>
          </p><p>
            This is the main list for general MySQL discussion. Please
            note that some topics are better discussed on the
            more-specialized lists. If you post to the wrong list, you
            may not get an answer.
          </p></li><li><p>
            <code class="literal">bugs</code>
          </p><p>
            This list is for people who want to stay informed about
            issues reported since the last release of MySQL or who want
            to be actively involved in the process of bug hunting and
            fixing. See <a href="introduction.html#bug-reports" title="1.7.1.3. How to Report Bugs or Problems">Section 1.7.1.3, “How to Report Bugs or Problems”</a>.
          </p></li><li><p>
            <code class="literal">internals</code>
          </p><p>
            This list is for people who work on the MySQL code. This is
            also the forum for discussions on MySQL development and for
            posting patches.
          </p></li><li><p>
            <code class="literal">mysqldoc</code>
          </p><p>
            This list is for people who work on the MySQL documentation:
            people from MySQL AB, translators, and other community
            members.
          </p></li><li><p>
            <code class="literal">benchmarks</code>
          </p><p>
            This list is for anyone interested in performance issues.
            Discussions concentrate on database performance (not limited
            to MySQL), but also include broader categories such as
            performance of the kernel, filesystem, disk system, and so
            on.
          </p></li><li><p>
            <code class="literal">packagers</code>
          </p><p>
            This list is for discussions on packaging and distributing
            MySQL. This is the forum used by distribution maintainers to
            exchange ideas on packaging MySQL and on ensuring that MySQL
            looks and feels as similar as possible on all supported
            platforms and operating systems.
          </p></li><li><p>
            <code class="literal">java</code>
          </p><p>
            This list is for discussions about the MySQL server and
            Java. It is mostly used to discuss JDBC drivers, including
            MySQL Connector/J.
          </p></li><li><p>
            <code class="literal">win32</code>
          </p><p>
            This list is for all topics concerning the MySQL software on
            Microsoft operating systems, such as Windows 9x, Me, NT,
            2000, XP, and 2003.
          </p></li><li><p>
            <code class="literal">myodbc</code>
          </p><p>
            This list is for all topics concerning connecting to the
            MySQL server with ODBC.
          </p></li><li><p>
            <code class="literal">gui-tools</code>
          </p><p>
            This list is for all topics concerning MySQL GUI tools,
            including <code class="literal">MySQL Administrator</code> and the
            <code class="literal">MySQL Control Center</code> graphical client.
          </p></li><li><p>
            <code class="literal">cluster</code>
          </p><p>
            This list is for discussion of MySQL Cluster.
          </p></li><li><p>
            <code class="literal">dotnet</code>
          </p><p>
            This list is for discussion of the MySQL server and the .NET
            platform. Mostly related to the MySQL Connector/Net
            provider.
          </p></li><li><p>
            <code class="literal">plusplus</code>
          </p><p>
            This list is for all topics concerning programming with the
            C++ API for MySQL.
          </p></li><li><p>
            <code class="literal">perl</code>
          </p><p>
            This list is for all topics concerning the Perl support for
            MySQL with <code class="literal">DBD::mysql</code>.
          </p></li></ul></div><p>
        If you're unable to get an answer to your questions from a MySQL
        mailing list or forum, one option is to purchase support from
        MySQL AB. This puts you in direct contact with MySQL developers.
      </p><p>
        The following table shows some MySQL mailing lists in languages
        other than English. These lists are not operated by MySQL AB.
      </p><div class="itemizedlist"><ul type="disc"><li><p>
            <code class="literal"><code class="email">&lt;<a href="mailto:mysql-france-subscribe@yahoogroups.com">mysql-france-subscribe@yahoogroups.com</a>&gt;</code></code>
          </p><p>
            A French mailing list.
          </p></li><li><p>
            <code class="literal"><code class="email">&lt;<a href="mailto:list@tinc.net">list@tinc.net</a>&gt;</code></code>
          </p><p>
            A Korean mailing list. Email <code class="literal">subscribe mysql
            your@email.address</code> to this list.
          </p></li><li><p>
            <code class="literal"><code class="email">&lt;<a href="mailto:mysql-de-request@lists.4t2.com">mysql-de-request@lists.4t2.com</a>&gt;</code></code>
          </p><p>
            A German mailing list. Email <code class="literal">subscribe mysql-de
            your@email.address</code> to this list. You can find
            information about this mailing list at
            <a href="http://www.4t2.com/mysql/" target="_top">http://www.4t2.com/mysql/</a>.
          </p></li><li><p>
            <code class="literal"><code class="email">&lt;<a href="mailto:mysql-br-request@listas.linkway.com.br">mysql-br-request@listas.linkway.com.br</a>&gt;</code></code>
          </p><p>
            A Portuguese mailing list. Email <code class="literal">subscribe mysql-br
            your@email.address</code> to this list.
          </p></li><li><p>
            <code class="literal"><code class="email">&lt;<a href="mailto:mysql-alta@elistas.net">mysql-alta@elistas.net</a>&gt;</code></code>
          </p><p>
            A Spanish mailing list. Email <code class="literal">subscribe mysql
            your@email.address</code> to this list.
          </p></li></ul></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="asking-questions"></a>1.7.1.2. Asking Questions or Reporting Bugs</h4></div></div></div><a class="indexterm" name="id2761949"></a><a class="indexterm" name="id2761958"></a><a class="indexterm" name="id2761970"></a><p>
        Before posting a bug report or question, please do the
        following:
      </p><div class="itemizedlist"><ul type="disc"><li><p>
            Start by searching the MySQL online manual at
            <a href="http://dev.mysql.com/doc/" target="_top">http://dev.mysql.com/doc/</a>. We try to keep the
            manual up to date by updating it frequently with solutions
            to newly found problems. The change history
            (<a href="http://dev.mysql.com/doc/mysql/en/News.html" target="_top">http://dev.mysql.com/doc/mysql/en/News.html</a>)
            can be particularly useful since it is quite possible that a
            newer version contains a solution to your problem.
          </p></li><li><p>
            Search in the bugs database at
            <a href="http://bugs.mysql.com/" target="_top">http://bugs.mysql.com/</a> to see whether the bug
            has been reported and fixed.
          </p></li><li><p>
            Search the MySQL mailing list archives at
            <a href="http://lists.mysql.com/" target="_top">http://lists.mysql.com/</a>.
          </p></li><li><p>
            You can also use <a href="http://www.mysql.com/search/" target="_top">http://www.mysql.com/search/</a>
            to search all the Web pages (including the manual) that are
            located at the MySQL AB Web site.
          </p></li></ul></div><p>
        If you can't find an answer in the manual or the archives, check
        with your local MySQL expert. If you still can't find an answer
        to your question, please follow the guidelines on sending mail
        to a MySQL mailing list, outlined in the next section, before
        contacting us.
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="bug-reports"></a>1.7.1.3. How to Report Bugs or Problems</h4></div></div></div><a class="indexterm" name="id2762074"></a><a class="indexterm" name="id2762087"></a><a class="indexterm" name="id2762099"></a><a class="indexterm" name="id2762112"></a><a class="indexterm" name="id2762124"></a><a class="indexterm" name="id2762135"></a><a class="indexterm" name="id2762148"></a><a class="indexterm" name="id2762161"></a><a class="indexterm" name="id2762170"></a><p>
        The normal place to report bugs is
        <a href="http://bugs.mysql.com/" target="_top">http://bugs.mysql.com/</a>, which is the address for
        our bugs database. This database is public, and can be browsed
        and searched by anyone. If you log in to the system, you can
        enter new reports.
      </p><p>
        Writing a good bug report takes patience, but doing it right the
        first time saves time both for us and for yourself. A good bug
        report, containing a full test case for the bug, makes it very
        likely that we will fix the bug in the next release. This
        section helps you write your report correctly so that you don't
        waste your time doing things that may not help us much or at
        all.
      </p><p>
        We encourage everyone to use the <span><strong class="command">mysqlbug</strong></span>
        script to generate a bug report (or a report about any problem).
        <span><strong class="command">mysqlbug</strong></span> can be found in the
        <code class="filename">scripts</code> directory (source distribution) and
        in the <code class="filename">bin</code> directory under your MySQL
        installation directory (binary distribution). If you are unable
        to use <span><strong class="command">mysqlbug</strong></span> (for example, if you are
        running on Windows), it is still vital that you include all the
        necessary information noted in this section (most importantly, a
        description of the operating system and the MySQL version).
      </p><p>
        The <span><strong class="command">mysqlbug</strong></span> script helps you generate a
        report by determining much of the following information
        automatically, but if something important is missing, please
        include it with your message. Please read this section carefully
        and make sure that all the information described here is
        included in your report.
      </p><p>
        Preferably, you should test the problem using the latest
        production or development version of MySQL Server before
        posting. Anyone should be able to repeat the bug by just using
        <code class="literal">mysql test &lt; script_file</code> on the included
        test case or by running the shell or Perl script that is
        included in the bug report.
      </p><p>
        All bugs posted in the bugs database at
        <a href="http://bugs.mysql.com/" target="_top">http://bugs.mysql.com/</a> are corrected or
        documented in the next MySQL release. If only minor code changes
        are needed to correct a problem, we may also post a patch that
        fixes the problem.
      </p><p>
        If you have found a sensitive security bug in MySQL, you can
        send email to <code class="email">&lt;<a href="mailto:security@mysql.com">security@mysql.com</a>&gt;</code>.
      </p><p>
        If you have a repeatable bug report, please report it to the
        bugs database at <a href="http://bugs.mysql.com/" target="_top">http://bugs.mysql.com/</a>. Note
        that even in this case it's good to run the
        <span><strong class="command">mysqlbug</strong></span> script first to find information
        about your system. Any bug that we are able to repeat has a high
        chance of being fixed in the next MySQL release.
      </p><p>
        To report other problems, you can use one of the MySQL mailing
        lists.
      </p><p>
        Remember that it is possible for us to respond to a message
        containing too much information, but not to one containing too
        little. People often omit facts because they think they know the
        cause of a problem and assume that some details don't matter. A
        good principle is this: If you are in doubt about stating
        something, state it. It is faster and less troublesome to write
        a couple more lines in your report than to wait longer for the
        answer if we must ask you to provide information that was
        missing from the initial report.
      </p><p>
        The most common errors made in bug reports are (a) not including
        the version number of the MySQL distribution used, and (b) not
        fully describing the platform on which the MySQL server is
        installed (including the platform type and version number). This
        is highly relevant information, and in 99 cases out of 100, the
        bug report is useless without it. Very often we get questions
        like, “<span class="quote">Why doesn't this work for me?</span>” Then we find
        that the feature requested wasn't implemented in that MySQL
        version, or that a bug described in a report has been fixed in
        newer MySQL versions. Sometimes the error is platform-dependent;
        in such cases, it is next to impossible for us to fix anything
        without knowing the operating system and the version number of
        the platform.
      </p><p>
        If you compiled MySQL from source, remember also to provide
        information about your compiler, if it is related to the
        problem. Often people find bugs in compilers and think the
        problem is MySQL-related. Most compilers are under development
        all the time and become better version by version. To determine
        whether your problem depends on your compiler, we need to know
        what compiler you use. Note that every compiling problem should
        be regarded as a bug and reported accordingly.
      </p><p>
        It is most helpful when a good description of the problem is
        included in the bug report. That is, give a good example of
        everything you did that led to the problem and describe, in
        exact detail, the problem itself. The best reports are those
        that include a full example showing how to reproduce the bug or
        problem. See <a href="porting.html#reproduceable-test-case" title="E.1.6. Making a Test Case If You Experience Table Corruption">Section E.1.6, “Making a Test Case If You Experience Table Corruption”</a>.
      </p><p>
        If a program produces an error message, it is very important to
        include the message in your report. If we try to search for
        something from the archives using programs, it is better that
        the error message reported exactly matches the one that the
        program produces. (Even the lettercase should be observed.) You
        should never try to reproduce from memory what the error message
        was; instead, copy and paste the entire message into your
        report.
      </p><p>
        If you have a problem with Connector/ODBC (MyODBC), please try
        to generate a trace file and send it with your report. See
        <a href="connectors.html#myodbc-bug-report" title="23.1.1.9. How to Report MyODBC Problems or Bugs">Section 23.1.1.9, “How to Report MyODBC Problems or Bugs”</a>.
      </p><p>
        Please remember that many of the people who read your report do
        so using an 80-column display. When generating reports or
        examples using the <span><strong class="command">mysql</strong></span> command-line tool,
        you should therefore use the <code class="option">--vertical</code> option
        (or the <code class="literal">\G</code> statement terminator) for output
        that would exceed the available width for such a display (for
        example, with the <code class="literal">EXPLAIN SELECT</code> statement;
        see the example later in this section).
      </p><a class="indexterm" name="id2762411"></a><p>
        Please include the following information in your report:
      </p><div class="itemizedlist"><ul type="disc"><li><p>
            The version number of the MySQL distribution you are using
            (for example, MySQL 4.0.12). You can find out which version
            you are running by executing <span><strong class="command">mysqladmin
            version</strong></span>. The <span><strong class="command">mysqladmin</strong></span> program
            can be found in the <code class="filename">bin</code> directory under
            your MySQL installation directory.
          </p></li><li><p>
            The manufacturer and model of the machine on which you
            experience the problem.
          </p></li><li><p>
            The operating system name and version. If you work with
            Windows, you can usually get the name and version number by
            double-clicking your My Computer icon and pulling down the
            “<span class="quote">Help/About Windows</span>” menu. For most Unix-like
            operating systems, you can get this information by executing
            the command <code class="literal">uname -a</code>.
          </p></li><li><p>
            Sometimes the amount of memory (real and virtual) is
            relevant. If in doubt, include these values.
          </p></li><li><p>
            If you are using a source distribution of the MySQL
            software, the name and version number of the compiler used
            are needed. If you have a binary distribution, the
            distribution name is needed.
          </p></li><li><p>
            If the problem occurs during compilation, include the exact
            error messages and also a few lines of context around the
            offending code in the file where the error occurs.
          </p></li><li><p>
            If <span><strong class="command">mysqld</strong></span> died, you should also report
            the query that crashed <span><strong class="command">mysqld</strong></span>. You can
            usually find this out by running <span><strong class="command">mysqld</strong></span>
            with query logging enabled, and then looking in the log
            after <span><strong class="command">mysqld</strong></span> crashes See
            <a href="porting.html#using-log-files" title="E.1.5. Using Log Files to Find Cause of Errors in mysqld">Section E.1.5, “Using Log Files to Find Cause of Errors in <span><strong class="command">mysqld</strong></span>”</a>.
          </p></li><li><p>
            If a database table is related to the problem, include the
            output from <span><strong class="command">mysqldump --no-data
            <em class="replaceable"><code>db_name</code></em>
            <em class="replaceable"><code>tbl_name</code></em></strong></span>. This is very
            easy to do and is a powerful way to get information about
            any table in a database. The information helps us create a
            situation matching the one you have experienced.
          </p></li><li><p>
            For speed-related bugs or problems with
            <code class="literal">SELECT</code> statements, you should always
            include the output of <code class="literal">EXPLAIN SELECT ...</code>,
            and at least the number of rows that the
            <code class="literal">SELECT</code> statement produces. You should
            also include the output from <code class="literal">SHOW CREATE TABLE
            <em class="replaceable"><code>tbl_name</code></em></code> for each
            involved table. The more information you give about your
            situation, the more likely it is that someone can help you.
          </p><p>
            The following is an example of a very good bug report. It
            should be posted with the <span><strong class="command">mysqlbug</strong></span>
            script. The example uses the <span><strong class="command">mysql</strong></span>
            command-line tool. Note the use of the <code class="literal">\G</code>
            statement terminator for statements whose output width would
            otherwise exceed that of an 80-column display device.
          </p><pre class="programlisting">mysql&gt; <strong class="userinput"><code>SHOW VARIABLES;</code></strong>
mysql&gt; <strong class="userinput"><code>SHOW COLUMNS FROM ...\G</code></strong>
       &lt;output from SHOW COLUMNS&gt;
mysql&gt; <strong class="userinput"><code>EXPLAIN SELECT ...\G</code></strong>
       &lt;output from EXPLAIN&gt;
mysql&gt; <strong class="userinput"><code>FLUSH STATUS;</code></strong>
mysql&gt; <strong class="userinput"><code>SELECT ...;</code></strong>
       &lt;A short version of the output from SELECT,
       including the time taken to run the query&gt;
mysql&gt; <strong class="userinput"><code>SHOW STATUS;</code></strong>
       &lt;output from SHOW STATUS&gt;
</pre></li><li><p>
            If a bug or problem occurs while running
            <span><strong class="command">mysqld</strong></span>, try to provide an input script
            that reproduces the anomaly. This script should include any
            necessary source files. The more closely the script can
            reproduce your situation, the better. If you can make a
            reproducible test case, you should post it on
            <a href="http://bugs.mysql.com/" target="_top">http://bugs.mysql.com/</a> for high-priority
            treatment.
          </p><p>
            If you can't provide a script, you should at least include
            the output from <span><strong class="command">mysqladmin variables
            extended-status processlist</strong></span> in your mail to
            provide some information on how your system is performing.
          </p></li><li><p>
            If you can't produce a test case with only a few rows, or if
            the test table is too big to be mailed to the mailing list
            (more than 10 rows), you should dump your tables using
            <span><strong class="command">mysqldump</strong></span> and create a
            <code class="filename">README</code> file that describes your
            problem.
          </p><p>
            Create a compressed archive of your files using
            <span><strong class="command">tar</strong></span> and <span><strong class="command">gzip</strong></span> or
            <span><strong class="command">zip</strong></span>, and use FTP to transfer the archive
            to <a href="ftp://ftp.mysql.com/pub/mysql/upload/" target="_top">ftp://ftp.mysql.com/pub/mysql/upload/</a>.
            Then enter the problem into our bugs database at
            <a href="http://bugs.mysql.com/" target="_top">http://bugs.mysql.com/</a>.
          </p></li><li><p>
            If you think that the MySQL server produces a strange result
            from a query, include not only the result, but also your
            opinion of what the result should be, and an account
            describing the basis for your opinion.
          </p></li><li><p>
            When giving an example of the problem, it's better to use
            the variable names, table names, and so on that exist in
            your actual situation than to come up with new names. The
            problem could be related to the name of a variable or table.
            These cases are rare, perhaps, but it is better to be safe
            than sorry. After all, it should be easier for you to
            provide an example that uses your actual situation, and it
            is by all means better for us. In case you have data that
            you don't want to show to others, you can use FTP to
            transfer it to
            <a href="ftp://ftp.mysql.com/pub/mysql/upload/" target="_top">ftp://ftp.mysql.com/pub/mysql/upload/</a>. If the
            information is really top secret and you don't want to show
            it even to us, then go ahead and provide an example using
            other names, but please regard this as the last choice.
          </p></li><li><p>
            Include all the options given to the relevant programs, if
            possible. For example, indicate the options that you use
            when you start the <span><strong class="command">mysqld</strong></span> server as well
            as the options that you use to run any MySQL client
            programs. The options to programs such as
            <span><strong class="command">mysqld</strong></span> and <span><strong class="command">mysql</strong></span>, and
            to the <span><strong class="command">configure</strong></span> script, are often keys
            to answers and are very relevant. It is never a bad idea to
            include them. If you use any modules, such as Perl or PHP,
            please include the version numbers of those as well.
          </p></li><li><p>
            If your question is related to the privilege system, please
            include the output of <span><strong class="command">mysqlaccess</strong></span>, the
            output of <span><strong class="command">mysqladmin reload</strong></span>, and all the
            error messages you get when trying to connect. When you test
            your privileges, you should first run
            <span><strong class="command">mysqlaccess</strong></span>. After this, execute
            <span><strong class="command">mysqladmin reload version</strong></span> and try to
            connect with the program that gives you trouble.
            <span><strong class="command">mysqlaccess</strong></span> can be found in the
            <code class="filename">bin</code> directory under your MySQL
            installation directory.
          </p></li><li><p>
            If you have a patch for a bug, do include it. But don't
            assume that the patch is all we need, or that we can use it,
            if you don't provide some necessary information such as test
            cases showing the bug that your patch fixes. We might find
            problems with your patch or we might not understand it at
            all; if so, we can't use it.
          </p><p>
            If we can't verify exactly what the purpose of the patch is,
            we won't use it. Test cases help us here. Show that the
            patch handles all the situations that may occur. If we find
            a borderline case (even a rare one) where the patch won't
            work, it may be useless.
          </p></li><li><p>
            Guesses about what the bug is, why it occurs, or what it
            depends on are usually wrong. Even the MySQL team can't
            guess such things without first using a debugger to
            determine the real cause of a bug.
          </p></li><li><p>
            Indicate in your bug report that you have checked the
            reference manual and mail archive so that others know you
            have tried to solve the problem yourself.
          </p></li><li><p>
            If you get a <code class="literal">parse error</code>, please check
            your syntax closely. If you can't find something wrong with
            it, it's extremely likely that your current version of MySQL
            Server doesn't support the syntax you are using. If you are
            using the current version and the manual at
            <a href="http://dev.mysql.com/doc/" target="_top">http://dev.mysql.com/doc/</a> doesn't cover the
            syntax you are using, MySQL Server doesn't support your
            query. In this case, your only options are to implement the
            syntax yourself or email <code class="email">&lt;<a href="mailto:licensing@mysql.com">licensing@mysql.com</a>&gt;</code>
            and ask for an offer to implement it.
          </p><p>
            If the manual covers the syntax you are using, but you have
            an older version of MySQL Server, you should check the MySQL
            change history to see when the syntax was implemented. In
            this case, you have the option of upgrading to a newer
            version of MySQL Server. See <a href="news.html" title="Appendix D. MySQL Change History">Appendix D, <i>MySQL Change History</i></a>.
          </p></li><li><p>
            If your problem is that your data appears corrupt or you get
            errors when you access a particular table, you should first
            check and then try to repair your tables with <code class="literal">CHECK
            TABLE</code> and <code class="literal">REPAIR TABLE</code> or with
            <span><strong class="command">myisamchk</strong></span>. See
            <a href="database-administration.html" title="Chapter 5. Database Administration">Chapter 5, <i>Database Administration</i></a>.
          </p><p>
            If you are running Windows, please verify the value of
            <code class="literal">lower_case_table_names</code> using the
            <code class="literal">SHOW VARIABLES LIKE
            'lower_case_table_names'</code> command.
          </p></li><li><p>
            If you often get corrupted tables, you should try to find
            out when and why this happens. In this case, the error log
            in the MySQL data directory may contain some information
            about what happened. (This is the file with the
            <code class="filename">.err</code> suffix in the name.) See
            <a href="database-administration.html#error-log" title="5.11.1. The Error Log">Section 5.11.1, “The Error Log”</a>. Please include any relevant
            information from this file in your bug report. Normally
            <span><strong class="command">mysqld</strong></span> should <span class="emphasis"><em>never</em></span>
            crash a table if nothing killed it in the middle of an
            update. If you can find the cause of
            <span><strong class="command">mysqld</strong></span> dying, it's much easier for us to
            provide you with a fix for the problem. See
            <a href="problems.html#what-is-crashing" title="A.1. How to Determine What Is Causing a Problem">Section A.1, “How to Determine What Is Causing a Problem”</a>.
          </p></li><li><p>
            If possible, download and install the most recent version of
            MySQL Server and check whether it solves your problem. All
            versions of the MySQL software are thoroughly tested and
            should work without problems. We believe in making
            everything as backward-compatible as possible, and you
            should be able to switch MySQL versions without difficulty.
            See <a href="installing.html#which-version" title="2.1.2. Choosing Which MySQL Distribution to Install">Section 2.1.2, “Choosing Which MySQL Distribution to Install”</a>.
          </p></li></ul></div><a class="indexterm" name="id2763020"></a><a class="indexterm" name="id2763032"></a><a class="indexterm" name="id2763045"></a><a class="indexterm" name="id2763057"></a><p>
        If you are a support customer, please cross-post the bug report
        to <code class="email">&lt;<a href="mailto:mysql-support@mysql.com">mysql-support@mysql.com</a>&gt;</code> for higher-priority
        treatment, as well as to the appropriate mailing list to see
        whether someone else has experienced (and perhaps solved) the
        problem.
      </p><p>
        For information on reporting bugs in MyODBC, see
        <a href="connectors.html#myodbc-bug-report" title="23.1.1.9. How to Report MyODBC Problems or Bugs">Section 23.1.1.9, “How to Report MyODBC Problems or Bugs”</a>.
      </p><p>
        For solutions to some common problems, see
        <a href="problems.html" title="Appendix A. Problems and Common Errors">Appendix A, <i>Problems and Common Errors</i></a>.
      </p><p>
        When answers are sent to you individually and not to the mailing
        list, it is considered good etiquette to summarize the answers
        and send the summary to the mailing list so that others may have
        the benefit of responses you received that helped you solve your
        problem.
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="answering-questions"></a>1.7.1.4. Guidelines for Answering Questions on the Mailing List</h4></div></div></div><a class="indexterm" name="id2763121"></a><a class="indexterm" name="id2763130"></a><a class="indexterm" name="id2763143"></a><a class="indexterm" name="id2763155"></a><p>
        If you consider your answer to have broad interest, you may want
        to post it to the mailing list instead of replying directly to
        the individual who asked. Try to make your answer general enough
        that people other than the original poster may benefit from it.
        When you post to the list, please make sure that your answer is
        not a duplication of a previous answer.
      </p><p>
        Try to summarize the essential part of the question in your
        reply; don't feel obliged to quote the entire original message.
      </p><p>
        Please don't post mail messages from your browser with HTML mode
        turned on. Many users don't read mail with a browser.
      </p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="irc"></a>1.7.2. MySQL Community Support on IRC (Internet Relay Chat)</h3></div></div></div><a class="indexterm" name="id2763202"></a><a class="indexterm" name="id2763211"></a><p>
      In addition to the various MySQL mailing lists, you can find
      experienced community people on <code class="literal">IRC</code>
      (<code class="literal">Internet Relay Chat</code>). These are the best
      networks/channels currently known to us:
    </p><div class="itemizedlist"><ul type="disc"><li><p>
          <span class="bold"><strong>freenode</strong></span> (see
          <a href="http://www.freenode.net/" target="_top">http://www.freenode.net/</a> for servers)
        </p><div class="itemizedlist"><ul type="circle"><li><p>
              <code class="literal">#mysql</code> Primarily MySQL questions, but
              other database and general SQL questions are welcome.
              Questions about PHP, Perl or C in combination with MySQL
              are also common.
            </p></li></ul></div></li></ul></div><p>
      If you are looking for IRC client software to connect to an IRC
      network, take a look at <code class="literal">xChat</code>
      (<a href="http://www.xchat.org/" target="_top">http://www.xchat.org/</a>). X-Chat (GPL licensed) is
      available for Unix as well as for Windows platforms (a free
      Windows build of X-Chat is available at
      <a href="http://www.silverex.org/download/" target="_top">http://www.silverex.org/download/</a>).
    </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="forums"></a>1.7.3. MySQL Community Support at the MySQL Forums</h3></div></div></div><a class="indexterm" name="id2763312"></a><p>
      The latest community support resource are the forums at
      <a href="http://forums.mysql.com" target="_top">http://forums.mysql.com</a>.
    </p><p>
      There are a variety of forums available, grouped in the following
      general categories:
    </p><div class="itemizedlist"><ul type="disc"><li><p>
          Migration
        </p></li><li><p>
          MySQL Usage
        </p></li><li><p>
          MySQL Connectors
        </p></li><li><p>
          Programming Languages
        </p></li><li><p>
          Tools
        </p></li><li><p>
          3rd-Party Applications
        </p></li><li><p>
          Storage Engines
        </p></li><li><p>
          MySQL Technology
        </p></li><li><p>
          SQL Standards
        </p></li><li><p>
          Business
        </p></li></ul></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="compatibility"></a>1.8. MySQL Standards Compliance</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="introduction.html#standards">1.8.1. What Standards MySQL Follows</a></span></dt><dt><span class="section"><a href="introduction.html#sql-mode">1.8.2. Selecting SQL Modes</a></span></dt><dt><span class="section"><a href="introduction.html#ansi-mode">1.8.3. Running MySQL in ANSI Mode</a></span></dt><dt><span class="section"><a href="introduction.html#extensions-to-ansi">1.8.4. MySQL Extensions to Standard SQL</a></span></dt><dt><span class="section"><a href="introduction.html#differences-from-ansi">1.8.5. MySQL Differences from Standard SQL</a></span></dt><dt><span class="section"><a href="introduction.html#constraints">1.8.6. How MySQL Deals with Constraints</a></span></dt></dl></div><a class="indexterm" name="id2763422"></a><a class="indexterm" name="id2763432"></a><a class="indexterm" name="id2763439"></a><a class="indexterm" name="id2763450"></a><a class="indexterm" name="id2763460"></a><p>
      This section describes how MySQL relates to the ANSI/ISO SQL
      standards. MySQL Server has many extensions to the SQL standard,
      and here you can find out what they are and how to use them. You
      can also find information about functionality missing from MySQL
      Server, and how to work around some differences.
    </p><p>
      The SQL standard has been evolving since 1986 and several versions
      exist. In this manual, “<span class="quote">SQL-92</span>” refers to the
      standard released in 1992, “<span class="quote">SQL:1999</span>” refers to the
      standard released in 1999, and “<span class="quote">SQL:2003</span>” refers to
      the current version of the standard. We use the phrase “<span class="quote">the
      SQL standard</span>” to mean the current version of the SQL
      Standard at any time.
    </p><p>
      Our goal is to not restrict MySQL Server usability for any usage
      without a very good reason for doing so. Even if we don't have the
      resources to perform development for every possible use, we are
      always willing to help and offer suggestions to people who are
      trying to use MySQL Server in new territories.
    </p><p>
      One of our main goals with the product is to continue to work
      toward compliance with the SQL standard, but without sacrificing
      speed or reliability. We are not afraid to add extensions to SQL
      or support for non-SQL features if this greatly increases the
      usability of MySQL Server for a large segment of our user base.
      The <code class="literal">HANDLER</code> interface in MySQL Server 4.0 is an
      example of this strategy. See <a href="sql-syntax.html#handler" title="13.2.3. HANDLER Syntax">Section 13.2.3, “<code class="literal">HANDLER</code> Syntax”</a>.
    </p><p>
      We continue to support transactional and non-transactional
      databases to satisfy both mission-critical 24/7 usage and heavy
      Web or logging usage.
    </p><p>
      MySQL Server was originally designed to work with medium size
      databases (10-100 million rows, or about 100MB per table) on small
      computer systems. Today MySQL Server handles terabyte-size
      databases, but the code can also be compiled in a reduced version
      suitable for hand-held and embedded devices. The compact design of
      the MySQL server makes development in both directions possible
      without any conflicts in the source tree.
    </p><p>
      Currently, we are not targeting realtime support, although MySQL
      replication capabilities offer significant functionality.
    </p><p>
      Database cluster support exists through third-party clustering
      solutions as well as the integration of our acquired NDB Cluster
      technology, available from version 4.1.2. See
      <a href="ndbcluster.html" title="Chapter 15. MySQL Cluster">Chapter 15, <i>MySQL Cluster</i></a>.
    </p><p>
      We are also looking at providing XML support in the database
      server.
    </p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="standards"></a>1.8.1. What Standards MySQL Follows</h3></div></div></div><p>
        We are aiming toward supporting the full ANSI/ISO SQL standard,
        but without making concessions to speed and quality of the code.
      </p><p>
        ODBC levels 0-3.51.
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sql-mode"></a>1.8.2. Selecting SQL Modes</h3></div></div></div><p>
        The MySQL server can operate in different SQL modes, and can
        apply these modes differentially for different clients. This
        allows an application to tailor server operation to its own
        requirements.
      </p><p>
        Modes define what SQL syntax MySQL should support and what kind
        of validation checks it should perform on the data. This makes
        it easier to use MySQL in a lot of different environments and to
        use MySQL together with other database servers.
      </p><p>
        You can set the default SQL mode by starting
        <span><strong class="command">mysqld</strong></span> with the
        <code class="option">--sql-mode="modes"</code> option. Beginning with MySQL
        4.1, you can also change the mode after startup time by setting
        the <code class="literal">sql_mode</code> variable with a <code class="literal">SET
        [SESSION|GLOBAL] sql_mode='modes'</code> statement.
      </p><p>
        For more information on setting the server mode, see
        <a href="database-administration.html#server-sql-mode" title="5.3.2. The Server SQL Mode">Section 5.3.2, “The Server SQL Mode”</a>.
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="ansi-mode"></a>1.8.3. Running MySQL in ANSI Mode</h3></div></div></div><a class="indexterm" name="id2763661"></a><a class="indexterm" name="id2763671"></a><p>
        You can tell <span><strong class="command">mysqld</strong></span> to use the ANSI mode with
        the <code class="option">--ansi</code> startup option. See
        <a href="database-administration.html#server-options" title="5.3.1. mysqld Command-Line Options">Section 5.3.1, “<span><strong class="command">mysqld</strong></span> Command-Line Options”</a>.
      </p><p>
        Running the server in ANSI mode is the same as starting it with
        these options (specify the <code class="option">--sql_mode</code> value on
        a single line):
      </p><pre class="programlisting">--transaction-isolation=SERIALIZABLE
--sql-mode=REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,
IGNORE_SPACE
</pre><p>
        In MySQL 4.1, you can achieve the same effect with these two
        statements (specify the <code class="literal">sql_mode</code> value on a
        single line):
      </p><pre class="programlisting">SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SET GLOBAL sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,
IGNORE_SPACE';
</pre><p>
        See <a href="introduction.html#sql-mode" title="1.8.2. Selecting SQL Modes">Section 1.8.2, “Selecting SQL Modes”</a>.
      </p><p>
        In MySQL 4.1.1, the <code class="literal">sql_mode</code> options shown
        can be also be set with this statement:
      </p><pre class="programlisting">SET GLOBAL sql_mode='ansi';
</pre><p>
        In this case, the value of the <code class="literal">sql_mode</code>
        variable is set to all options that are relevant for ANSI mode.
        You can check the result like this:
      </p><pre class="programlisting">mysql&gt; <strong class="userinput"><code>SET GLOBAL sql_mode='ansi';</code></strong>
mysql&gt; <strong class="userinput"><code>SELECT @@global.sql_mode;</code></strong>
        -&gt; 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,
            IGNORE_SPACE,ANSI';
</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="extensions-to-ansi"></a>1.8.4. MySQL Extensions to Standard SQL</h3></div></div></div><a class="indexterm" name="id2763785"></a><p>
        The MySQL Server includes some extensions that you probably
        won't find in other SQL DBMSs. Be warned that if you use them,
        your code won't be portable to other SQL servers. In some cases,
        you can write code that includes MySQL extensions, but is still
        portable, by using comments of the form <code class="literal">/*! ...
        */</code>. In this case, MySQL Server parses and execute the
        code within the comment as it would any other MySQL statement,
        but other SQL servers will ignore the extensions. For example:
      </p><pre class="programlisting">SELECT /*! STRAIGHT_JOIN */ col_name FROM table1,table2 WHERE ...
</pre><p>
        If you add a version number after the
        ‘<code class="literal">!</code>’ character, the syntax within
        the comment is executed only if the MySQL version is equal to or
        newer than the specified version number:
      </p><pre class="programlisting">CREATE /*!32302 TEMPORARY */ TABLE t (a INT);
</pre><p>
        This means that if you have Version 3.23.02 or newer, MySQL
        Server uses the <code class="literal">TEMPORARY</code> keyword.
      </p><p>
        The following descriptions list MySQL extensions, organized by
        category.
      </p><div class="itemizedlist"><ul type="disc"><li><p>
            Organization of data on disk
          </p><p>
            MySQL Server maps each database to a directory under the
            MySQL data directory, and tables within a database to
            filenames in the database directory. This has a few
            implications:
          </p><div class="itemizedlist"><ul type="circle"><li><p>
                <a class="indexterm" name="id2763863"></a>

                <a class="indexterm" name="id2763874"></a>

                <a class="indexterm" name="id2763884"></a>

                <a class="indexterm" name="id2763894"></a>

                Database names and table names are case sensitive in
                MySQL Server on operating systems that have
                case-sensitive filenames (such as most Unix systems).
                See <a href="language-structure.html#name-case-sensitivity" title="9.2.2. Identifier Case Sensitivity">Section 9.2.2, “Identifier Case Sensitivity”</a>.
              </p></li><li><p>
                You can use standard system commands to back up, rename,
                move, delete, and copy tables that are managed by the
                <code class="literal">MyISAM</code> or <code class="literal">ISAM</code>
                storage engines. For example, to rename a
                <code class="literal">MyISAM</code> table, rename the
                <code class="filename">.MYD</code>, <code class="filename">.MYI</code>,
                and <code class="filename">.frm</code> files to which the table
                corresponds.
              </p></li></ul></div><p>
            Database, table, index, column, or alias names may begin
            with a digit (but may not consist solely of digits).
          </p></li><li><p>
            General language syntax
          </p><div class="itemizedlist"><ul type="circle"><li><p>
                Strings may be enclosed by either
                ‘<code class="literal">"</code>’ or
                ‘<code class="literal">'</code>’, not just by
                ‘<code class="literal">'</code>’.
              </p></li><li><p>
                Use of ‘<code class="literal">\</code>’ as an escape
                character in strings.
              </p></li><li><p>
                In SQL statements, you can access tables from different
                databases with the
                <em class="replaceable"><code>db_name.tbl_name</code></em> syntax. Some
                SQL servers provide the same functionality but call this
                <code class="literal">User space</code>. MySQL Server doesn't
                support tablespaces such as used in statements like
                this: <code class="literal">CREATE TABLE ralph.my_table...IN
                my_tablespace</code>.
              </p></li></ul></div></li><li><p>
            SQL statement syntax
          </p><div class="itemizedlist"><ul type="circle"><li><p>
                The <code class="literal">ANALYZE TABLE</code>, <code class="literal">CHECK
                TABLE</code>, <code class="literal">OPTIMIZE TABLE</code>, and
                <code class="literal">REPAIR TABLE</code> statements.
              </p></li><li><p>
                The <code class="literal">CREATE DATABASE</code> and <code class="literal">DROP
                DATABASE</code> statements. See
                <a href="sql-syntax.html#create-database" title="13.1.3. CREATE DATABASE Syntax">Section 13.1.3, “<code class="literal">CREATE DATABASE</code> Syntax”</a>.
              </p></li><li><p>
                The <code class="literal">DO</code> statement.
              </p></li><li><p>
                <code class="literal">EXPLAIN SELECT</code> to get a description
                of how tables are joined.
              </p></li><li><p>
                The <code class="literal">FLUSH</code> and
                <code class="literal">RESET</code> statements.
              </p></li><li><p>
                The <code class="literal">SET</code> statement. See
                <a href="sql-syntax.html#set-option" title="13.5.3. SET Syntax">Section 13.5.3, “<code class="literal">SET</code> Syntax”</a>.
              </p></li><li><p>
                The <code class="literal">SHOW</code> statement. See
                <a href="sql-syntax.html#show" title="13.5.4. SHOW Syntax">Section 13.5.4, “<code class="literal">SHOW</code> Syntax”</a>.
              </p><a class="indexterm" name="id2764144"></a><a class="indexterm" name="id2764151"></a></li><li><p>
                Use of <code class="literal">LOAD DATA INFILE</code>. In many
                cases, this syntax is compatible with Oracle's
                <code class="literal">LOAD DATA INFILE</code>. See
                <a href="sql-syntax.html#load-data" title="13.2.5. LOAD DATA INFILE Syntax">Section 13.2.5, “<code class="literal">LOAD DATA INFILE</code> Syntax”</a>.
              </p></li><li><p>
                Use of <code class="literal">RENAME TABLE</code>. See
                <a href="sql-syntax.html#rename-table" title="13.1.9. RENAME TABLE Syntax">Section 13.1.9, “<code class="literal">RENAME TABLE</code> Syntax”</a>.
              </p></li><li><p>
                Use of <code class="literal">REPLACE</code> instead of
                <code class="literal">DELETE</code> + <code class="literal">INSERT</code>.
                See <a href="sql-syntax.html#replace" title="13.2.6. REPLACE Syntax">Section 13.2.6, “<code class="literal">REPLACE</code> Syntax”</a>.
              </p></li><li><p>
                Use of <code class="literal">CHANGE col_name</code>, <code class="literal">DROP
                col_name</code>, or <code class="literal">DROP INDEX</code>,
                <code class="literal">IGNORE</code> or <code class="literal">RENAME</code>
                in an <code class="literal">ALTER TABLE</code> statement. Use of
                multiple <code class="literal">ADD</code>,
                <code class="literal">ALTER</code>, <code class="literal">DROP</code>, or
                <code class="literal">CHANGE</code> clauses in an <code class="literal">ALTER
                TABLE</code> statement. See
                <a href="sql-syntax.html#alter-table" title="13.1.2. ALTER TABLE Syntax">Section 13.1.2, “<code class="literal">ALTER TABLE</code> Syntax”</a>.
              </p></li><li><p>
                Use of index names, indexes on a prefix of a field, and
                use of <code class="literal">INDEX</code> or
                <code class="literal">KEY</code> in a <code class="literal">CREATE
                TABLE</code> statement. See
                <a href="sql-syntax.html#create-table" title="13.1.5. CREATE TABLE Syntax">Section 13.1.5, “<code class="literal">CREATE TABLE</code> Syntax”</a>.
              </p></li><li><p>
                Use of <code class="literal">TEMPORARY</code> or <code class="literal">IF NOT
                EXISTS</code> with <code class="literal">CREATE TABLE</code>.
              </p></li><li><p>
                Use of <code class="literal">IF EXISTS</code> with <code class="literal">DROP
                TABLE</code>.
              </p></li><li><p>
                You can drop multiple tables with a single <code class="literal">DROP
                TABLE</code> statement.
              </p></li><li><p>
                The <code class="literal">ORDER BY</code> and
                <code class="literal">LIMIT</code> clauses of the
                <code class="literal">UPDATE</code> and <code class="literal">DELETE</code>
                statements.
              </p></li><li><p>
                <code class="literal">INSERT INTO ... SET col_name = ...</code>
                syntax.
              </p></li><li><p>
                The <code class="literal">DELAYED</code> clause of the
                <code class="literal">INSERT</code> and <code class="literal">REPLACE</code>
                statements.
              </p></li><li><p>
                The <code class="literal">LOW_PRIORITY</code> clause of the
                <code class="literal">INSERT</code>, <code class="literal">REPLACE</code>,
                <code class="literal">DELETE</code>, and <code class="literal">UPDATE</code>
                statements.
              </p></li><li><p>
                Use of <code class="literal">INTO OUTFILE</code> and
                <code class="literal">STRAIGHT_JOIN</code> in a
                <code class="literal">SELECT</code> statement. See
                <a href="sql-syntax.html#select" title="13.2.7. SELECT Syntax">Section 13.2.7, “<code class="literal">SELECT</code> Syntax”</a>.
              </p></li><li><p>
                The <code class="literal">SQL_SMALL_RESULT</code> option in a
                <code class="literal">SELECT</code> statement.
              </p></li><li><p>
                You don't need to name all selected columns in the
                <code class="literal">GROUP BY</code> part. This gives better
                performance for some very specific, but quite normal
                queries. See
                <a href="functions.html#group-by-functions-and-modifiers" title="12.10. Functions and Modifiers for Use with GROUP BY Clauses">Section 12.10, “Functions and Modifiers for Use with <code class="literal">GROUP BY</code> Clauses”</a>.
              </p></li><li><p>
                You can specify <code class="literal">ASC</code> and
                <code class="literal">DESC</code> with <code class="literal">GROUP
                BY</code>.
              </p></li><li><p>
                The ability to set variables in a statement with the
                <code class="literal">:=</code> assignment operator:
              </p><pre class="programlisting">mysql&gt; <strong class="userinput"><code>SELECT @a:=SUM(total),@b=COUNT(*),@a/@b AS avg</code></strong>
    -&gt; <strong class="userinput"><code>FROM test_table;</code></strong>
mysql&gt; <strong class="userinput"><code>SELECT @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;</code></strong>
</pre></li></ul></div></li><li><p>
            Column types
          </p><div class="itemizedlist"><ul type="circle"><li><p>
                The column types <code class="literal">MEDIUMINT</code>,
                <code class="literal">SET</code>, <code class="literal">ENUM</code>, and the
                different <code class="literal">BLOB</code> and
                <code class="literal">TEXT</code> types.
              </p></li><li><p>
                The column attributes <code class="literal">AUTO_INCREMENT</code>,
                <code class="literal">BINARY</code>, <code class="literal">NULL</code>,
                <code class="literal">UNSIGNED</code>, and
                <code class="literal">ZEROFILL</code>.
              </p></li></ul></div></li><li><p>
            Functions and operators
          </p><div class="itemizedlist"><ul type="circle"><li><p>
                To make it easier for users who come from other SQL
                environments, MySQL Server supports aliases for many
                functions. For example, all string functions support
                both standard SQL syntax and ODBC syntax.
              </p></li><li><p>
                MySQL Server understands the <code class="literal">||</code> and
                <code class="literal">&amp;&amp;</code> operators to mean logical
                OR and AND, as in the C programming language. In MySQL
                Server, <code class="literal">||</code> and <code class="literal">OR</code>
                are synonyms, as are <code class="literal">&amp;&amp;</code> and
                <code class="literal">AND</code>. Because of this nice syntax,
                MySQL Server doesn't support the standard SQL
                <code class="literal">||</code> operator for string concatenation;
                use <code class="literal">CONCAT()</code> instead. Because
                <code class="literal">CONCAT()</code> takes any number of
                arguments, it's easy to convert use of the
                <code class="literal">||</code> operator to MySQL Server.
              </p></li><li><p>
                Use of <code class="literal">COUNT(DISTINCT list)</code> where
                <code class="literal">list</code> has more than one element.
              </p></li><li><p>
                All string comparisons are case-insensitive by default,
                with sort ordering determined by the current character
                set (cp1252 Latin1 by default). If you don't like this,
                you should declare your columns with the
                <code class="literal">BINARY</code> attribute or use the
                <code class="literal">BINARY</code> cast, which causes comparisons
                to be done using the underlying character code values
                rather then a lexical ordering.
              </p><a class="indexterm" name="id2764706"></a><a class="indexterm" name="id2764712"></a></li><li><p>
                The <code class="literal">%</code> operator is a synonym for
                <code class="literal">MOD()</code>. That is, <code class="literal">N %
                M</code> is equivalent to
                <code class="literal">MOD(N,M)</code>. <code class="literal">%</code> is
                supported for C programmers and for compatibility with
                PostgreSQL.
              </p></li><li><p>
                The <code class="literal">=</code>, <code class="literal">&lt;&gt;</code>,
                <code class="literal">&lt;=</code>,<code class="literal">&lt;</code>,
                <code class="literal">&gt;=</code>,<code class="literal">&gt;</code>,
                <code class="literal">&lt;&lt;</code>,
                <code class="literal">&gt;&gt;</code>,
                <code class="literal">&lt;=&gt;</code>, <code class="literal">AND</code>,
                <code class="literal">OR</code>, or <code class="literal">LIKE</code>
                operators may be used in column comparisons to the left
                of the <code class="literal">FROM</code> in
                <code class="literal">SELECT</code> statements. For example:
              </p><pre class="programlisting">mysql&gt; <strong class="userinput"><code>SELECT col1=1 AND col2=2 FROM <em class="replaceable"><code>tbl_name</code></em>;</code></strong>
</pre></li><li><p>
                The <code class="literal">LAST_INSERT_ID()</code> function that
                returns the most recent
                <code class="literal">AUTO_INCREMENT</code> value. See
                <a href="functions.html#information-functions" title="12.9.3. Information Functions">Section 12.9.3, “Information Functions”</a>.
              </p></li><li><p>
                <code class="literal">LIKE</code> is allowed on numeric columns.
              </p></li><li><p>
                The <code class="literal">REGEXP</code> and <code class="literal">NOT
                REGEXP</code> extended regular expression operators.
              </p></li><li><p>
                <code class="literal">CONCAT()</code> or <code class="literal">CHAR()</code>
                with one argument or more than two arguments. (In MySQL
                Server, these functions can take any number of
                arguments.)
              </p></li><li><p>
                The <code class="literal">BIT_COUNT()</code>,
                <code class="literal">CASE</code>, <code class="literal">ELT()</code>,
                <code class="literal">FROM_DAYS()</code>,
                <code class="literal">FORMAT()</code>, <code class="literal">IF()</code>,
                <code class="literal">PASSWORD()</code>,
                <code class="literal">ENCRYPT()</code>, <code class="literal">MD5()</code>,
                <code class="literal">ENCODE()</code>,
                <code class="literal">DECODE()</code>,
                <code class="literal">PERIOD_ADD()</code>,
                <code class="literal">PERIOD_DIFF()</code>,
                <code class="literal">TO_DAYS()</code>, and
                <code class="literal">WEEKDAY()</code> functions.
              </p></li><li><p>
                Use of <code class="literal">TRIM()</code> to trim substrings.
                Standard SQL supports removal of single characters only.
              </p></li><li><p>
                The <code class="literal">GROUP BY</code> functions
                <code class="literal">STD()</code>, <code class="literal">BIT_OR()</code>,
                <code class="literal">BIT_AND()</code>,
                <code class="literal">BIT_XOR()</code>, and
                <code class="literal">GROUP_CONCAT()</code>. See
                <a href="functions.html#group-by-functions-and-modifiers" title="12.10. Functions and Modifiers for Use with GROUP BY Clauses">Section 12.10, “Functions and Modifiers for Use with <code class="literal">GROUP BY</code> Clauses”</a>.
              </p></li></ul></div></li></ul></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="differences-from-ansi"></a>1.8.5. MySQL Differences from Standard SQL</h3></div></div></div><div class="toc"><dl><dt><span class="section"><a href="introduction.html#ansi-diff-subqueries">1.8.5.1. Subqueries</a></span></dt><dt><span class="section"><a href="introduction.html#ansi-diff-select-into-table">1.8.5.2. <code class="literal">SELECT INTO TABLE</code></a></span></dt><dt><span class="section"><a href="introduction.html#ansi-diff-transactions">1.8.5.3. Transactions and Atomic Operations</a></span></dt><dt><span class="section"><a href="introduction.html#ansi-diff-triggers">1.8.5.4. Stored Procedures and Triggers</a></span></dt><dt><span class="section"><a href="introduction.html#ansi-diff-foreign-keys">1.8.5.5. Foreign Keys</a></span></dt><dt><span class="section"><a href="introduction.html#ansi-diff-views">1.8.5.6. Views</a></span></dt><dt><span class="section"><a href="introduction.html#ansi-diff-comments">1.8.5.7. '<code class="literal">--</code>' as the Start of a Comment</a></span></dt></dl></div><p>
        We try to make MySQL Server follow the ANSI SQL standard and the
        ODBC SQL standard, but MySQL Server performs operations
        differently in some cases:
      </p><div class="itemizedlist"><ul type="disc"><li><p>
            For <code class="literal">VARCHAR</code> columns, trailing spaces are
            removed when the value is stored. (Fixed in MySQL 5.0.3).
            See <a href="problems.html#bugs" title="A.8. Known Issues in MySQL">Section A.8, “Known Issues in MySQL”</a>.
          </p></li><li><p>
            In some cases, <code class="literal">CHAR</code> columns are silently
            converted to <code class="literal">VARCHAR</code> columns when you
            define a table or alter its structure. (Fixed in MySQL
            5.0.3). See <a href="sql-syntax.html#silent-column-changes" title="13.1.5.1. Silent Column Specification Changes">Section 13.1.5.1, “Silent Column Specification Changes”</a>.
          </p></li><li><p>
            Privileges for a table are not automatically revoked when
            you delete a table. You must explicitly issue a
            <code class="literal">REVOKE</code> statement to revoke privileges for
            a table. See <a href="sql-syntax.html#grant" title="13.5.1.3. GRANT and REVOKE Syntax">Section 13.5.1.3, “<code class="literal">GRANT</code> and <code class="literal">REVOKE</code> Syntax”</a>.
          </p></li><li><p>
            The <code class="literal">CAST()</code> function does not support cast
            to <code class="literal">REAL</code> or <code class="literal">BIGINT</code>. See
            <a href="functions.html#cast-functions" title="12.8. Cast Functions and Operators">Section 12.8, “Cast Functions and Operators”</a>.
          </p></li><li><p>
            Standard SQL requires that a <code class="literal">HAVING</code>
            clause in a <code class="literal">SELECT</code> statement be able to
            refer to columns in the <code class="literal">GROUP BY</code> clause.
            This cannot be done before MySQL 5.0.2.
          </p></li></ul></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="ansi-diff-subqueries"></a>1.8.5.1. Subqueries</h4></div></div></div><p>
          MySQL 4.1 supports subqueries and derived tables. A
          “<span class="quote">subquery</span>” is a <code class="literal">SELECT</code>
          statement nested within another statement. A “<span class="quote">derived
          table</span>” (an unnamed view) is a subquery in the
          <code class="literal">FROM</code> clause of another statement. See
          <a href="sql-syntax.html#subqueries" title="13.2.8. Subquery Syntax">Section 13.2.8, “Subquery Syntax”</a>.
        </p><p>
          For MySQL versions older than 4.1, most subqueries can be
          rewritten using joins or other methods. See
          <a href="sql-syntax.html#rewriting-subqueries" title="13.2.8.11. Rewriting Subqueries as Joins for Earlier MySQL Versions">Section 13.2.8.11, “Rewriting Subqueries as Joins for Earlier MySQL Versions”</a> for examples that show
          how to do this.
        </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="ansi-diff-select-into-table"></a>1.8.5.2. <code class="literal">SELECT INTO TABLE</code></h4></div></div></div><a class="indexterm" name="id2765195"></a><p>
          MySQL Server doesn't support the Sybase SQL extension:
          <code class="literal">SELECT ... INTO TABLE ...</code>. Instead, MySQL
          Server supports the standard SQL syntax <code class="literal">INSERT INTO
          ... SELECT ...</code>, which is basically the same thing.
          See <a href="sql-syntax.html#insert-select" title="13.2.4.1. INSERT ... SELECT Syntax">Section 13.2.4.1, “<code class="literal">INSERT ... SELECT</code> Syntax”</a>.
        </p><pre class="programlisting">INSERT INTO tbl_temp2 (fld_id)
    SELECT tbl_temp1.fld_order_id
    FROM tbl_temp1 WHERE tbl_temp1.fld_order_id &gt; 100;
</pre><p>
          Alternatively, you can use <code class="literal">SELECT INTO OUTFILE
          ...</code> or <code class="literal">CREATE TABLE ... SELECT</code>.
        </p><p>
          From version 5.0, MySQL supports <code class="literal">SELECT ...
          INTO</code> with user variables. The same syntax may also
          be used inside stored procedures using cursors and local
          variables. See <a href="stored-procedures.html#select-into-statement" title="17.2.9.3. SELECT ... INTO Statement">Section 17.2.9.3, “<code class="literal">SELECT ... INTO</code> Statement”</a>.
        </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="ansi-diff-transactions"></a>1.8.5.3. Transactions and Atomic Operations</h4></div></div></div><a class="indexterm" name="id2765270"></a><a class="indexterm" name="id2765279"></a><a class="indexterm" name="id2765288"></a><a class="indexterm" name="id2765298"></a><a class="indexterm" name="id2765305"></a><a class="indexterm" name="id2765315"></a><a class="indexterm" name="id2765325"></a><a class="indexterm" name="id2765334"></a><a class="indexterm" name="id2765343"></a><p>
          MySQL Server (version 3.23-max and all versions 4.0 and above)
          supports transactions with the <code class="literal">InnoDB</code> and
          <code class="literal">BDB</code> transactional storage engines.
          <code class="literal">InnoDB</code> provides <span class="emphasis"><em>full</em></span>
          <code class="literal">ACID</code> compliance. See
          <a href="storage-engines.html" title="Chapter 14. Storage Engines and Table Types">Chapter 14, <i>Storage Engines and Table Types</i></a>.
        </p><p>
          The other non-transactional storage engines in MySQL Server
          (such as <code class="literal">MyISAM</code>) follow a different
          paradigm for data integrity called “<span class="quote">atomic
          operations.</span>” In transactional terms,
          <code class="literal">MyISAM</code> tables effectively always operate in
          <code class="literal">AUTOCOMMIT=1</code> mode. Atomic operations often
          offer comparable integrity with higher performance.
        </p><p>
          With MySQL Server supporting both paradigms, you can decide
          whether your applications are best served by the speed of
          atomic operations or the use of transactional features. This
          choice can be made on a per-table basis.
        </p><p>
          As noted, the trade-off for transactional versus
          non-transactional table types lies mostly in performance.
          Transactional tables have significantly higher memory and
          diskspace requirements, and more CPU overhead. On the other
          hand, transactional table types such as
          <code class="literal">InnoDB</code> also offer many significant
          features. MySQL Server's modular design allows the concurrent
          use of different storage engines to suit different
          requirements and deliver optimum performance in all
          situations.
        </p><p>
          But how do you use the features of MySQL Server to maintain
          rigorous integrity even with the non-transactional
          <code class="literal">MyISAM</code> tables, and how do these features
          compare with the transactional table types?
        </p><div class="orderedlist"><ol type="1"><li><p>
              If your applications are written in a way that is
              dependent on being able to call
              <code class="literal">ROLLBACK</code> rather than
              <code class="literal">COMMIT</code> in critical situations,
              transactions are more convenient. Transactions also ensure
              that unfinished updates or corrupting activities are not
              committed to the database; the server is given the
              opportunity to do an automatic rollback and your database
              is saved.
            </p><p>
              If you use non-transactional tables, MySQL Server in
              almost all cases allows you to resolve potential problems
              by including simple checks before updates and by running
              simple scripts that check the databases for
              inconsistencies and automatically repair or warn if such
              an inconsistency occurs. Note that just by using the MySQL
              log or even adding one extra log, you can normally fix
              tables perfectly with no data integrity loss.
            </p></li><li><p>
              More often than not, critical transactional updates can be
              rewritten to be atomic. Generally speaking, all integrity
              problems that transactions solve can be done with
              <code class="literal">LOCK TABLES</code> or atomic updates, ensuring
              that there are no automatic aborts from the server, which
              is a common problem with transactional database systems.
            </p></li><li><p>
              To be safe with MySQL Server, whether or not using
              transactional tables, you only need to have backups and
              have binary logging turned on. With this you can recover
              from any situation that you could with any other
              transactional database system. It is always good to have
              backups, regardless of which database system you use.
            </p></li></ol></div><p>
          The transactional paradigm has its benefits and its drawbacks.
          Many users and application developers depend on the ease with
          which they can code around problems where an abort appears to
          be, or is necessary. However, even if you are new to the
          atomic operations paradigm, or more familiar with
          transactions, do consider the speed benefit that
          non-transactional tables can offer on the order of three to
          five times the speed of the fastest and most optimally tuned
          transactional tables.
        </p><p>
          In situations where integrity is of highest importance, MySQL
          Server offers transaction-level reliability and integrity even
          for non-transactional tables. If you lock tables with
          <code class="literal">LOCK TABLES</code>, all updates stall until
          integrity checks are made. If you obtain a <code class="literal">READ
          LOCAL</code> lock (as opposed to a write lock) for a table
          that allows concurrent inserts at the end of the table, reads
          are allowed, as are inserts by other clients. The newly
          inserted records are not be seen by the client that has the
          read lock until it releases the lock. With <code class="literal">INSERT
          DELAYED</code>, you can queue inserts into a local queue,
          until the locks are released, without having the client wait
          for the insert to complete. See
          <a href="sql-syntax.html#insert-delayed" title="13.2.4.2. INSERT DELAYED Syntax">Section 13.2.4.2, “<code class="literal">INSERT DELAYED</code> Syntax”</a>.
        </p><p>
          “<span class="quote">Atomic,</span>” in the sense that we mean it, is
          nothing magical. It only means that you can be sure that while
          each specific update is running, no other user can interfere
          with it, and there can never be an automatic rollback (which
          can happen with transactional tables if you are not very
          careful). MySQL Server also guarantees that there are no dirty
          reads.
        </p><p>
          Following are some techniques for working with
          non-transactional tables:
        </p><div class="itemizedlist"><ul type="disc"><li><p>
              Loops that need transactions normally can be coded with
              the help of <code class="literal">LOCK TABLES</code>, and you don't
              need cursors to update records on the fly.
            </p></li><li><p>
              To avoid using <code class="literal">ROLLBACK</code>, you can use
              the following strategy:
            </p><div class="orderedlist"><ol type="1"><li><p>
                  Use <code class="literal">LOCK TABLES</code> to lock all the
                  tables you want to access.
                </p></li><li><p>
                  Test the conditions that must be true before
                  performing the update.
                </p></li><li><p>
                  Update if everything is okay.
                </p></li><li><p>
                  Use <code class="literal">UNLOCK TABLES</code> to release your
                  locks.
                </p></li></ol></div><p>
              This is usually a much faster method than using
              transactions with possible rollbacks, although not always.
              The only situation this solution doesn't handle is when
              someone kills the threads in the middle of an update. In
              this case, all locks are released but some of the updates
              may not have been executed.
            </p></li><li><p>
              You can also use functions to update records in a single
              operation. You can get a very efficient application by
              using the following techniques:
            </p><div class="itemizedlist"><ul type="circle"><li><p>
                  Modify columns relative to their current value.
                </p></li><li><p>
                  Update only those columns that actually have changed.
                </p></li></ul></div><p>
              For example, when we are doing updates to some customer
              information, we update only the customer data that has
              changed and test only that none of the changed data, or
              data that depends on the changed data, has changed
              compared to the original row. The test for changed data is
              done with the <code class="literal">WHERE</code> clause in the
              <code class="literal">UPDATE</code> statement. If the record wasn't
              updated, we give the client a message: “<span class="quote">Some of the
              data you have changed has been changed by another
              user.</span>” Then we show the old row versus the new row
              in a window so that the user can decide which version of
              the customer record to use.
            </p><p>
              This gives us something that is similar to column locking
              but is actually even better because we only update some of
              the columns, using values that are relative to their
              current values. This means that typical
              <code class="literal">UPDATE</code> statements look something like
              these:
            </p><pre class="programlisting">UPDATE tablename SET pay_back=pay_back+125;

UPDATE customer
  SET
    customer_date='current_date',
    address='new address',
    phone='new phone',
    money_owed_to_us=money_owed_to_us-125
  WHERE
    customer_id=id AND address='old address' AND phone='old phone';
</pre><p>
              This is very efficient and works even if another client
              has changed the values in the <code class="literal">pay_back</code>
              or <code class="literal">money_owed_to_us</code> columns.
            </p></li><li><p>
              <a class="indexterm" name="id2765755"></a>

              <a class="indexterm" name="id2765764"></a>

              In many cases, users have wanted <code class="literal">LOCK
              TABLES</code> and/or <code class="literal">ROLLBACK</code> for
              the purpose of managing unique identifiers. This can be
              handled much more efficiently without locking or rolling
              back by using an <code class="literal">AUTO_INCREMENT</code> column
              and either the <code class="literal">LAST_INSERT_ID()</code> SQL
              function or the <code class="literal">mysql_insert_id()</code> C API
              function. See <a href="functions.html#information-functions" title="12.9.3. Information Functions">Section 12.9.3, “Information Functions”</a>. See
              <a href="apis.html#mysql-insert-id" title="22.2.3.36. mysql_insert_id()">Section 22.2.3.36, “<code class="literal">mysql_insert_id()</code>”</a>.
            </p><a class="indexterm" name="id2765809"></a><a class="indexterm" name="id2765819"></a><p>
              You can generally code around the need for row-level
              locking. Some situations really do need it, and
              <code class="literal">InnoDB</code> tables support row-level
              locking. With <code class="literal">MyISAM</code> tables, you can
              use a flag column in the table and do something like the
              following:
            </p><pre class="programlisting">UPDATE <em class="replaceable"><code>tbl_name</code></em> SET row_flag=1 WHERE id=ID;
</pre><p>
              MySQL returns <code class="literal">1</code> for the number of
              affected rows if the row was found and
              <code class="literal">row_flag</code> wasn't <code class="literal">1</code> in
              the original row.
            </p><p>
              You can think of it as though MySQL Server changed the
              preceding query to:
            </p><pre class="programlisting">UPDATE <em class="replaceable"><code>tbl_name</code></em> SET row_flag=1 WHERE id=ID AND row_flag &lt;&gt; 1;
</pre></li></ul></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="ansi-diff-triggers"></a>1.8.5.4. Stored Procedures and Triggers</h4></div></div></div><a class="indexterm" name="id2765897"></a><a class="indexterm" name="id2765908"></a><a class="indexterm" name="id2765918"></a><p>
          Stored procedures are implemented in MySQL version 5.0. See
          <a href="stored-procedures.html" title="Chapter 17. Stored Procedures and Functions">Chapter 17, <i>Stored Procedures and Functions</i></a>.
        </p><p>
          Basic triggers functionality is implemented in MySQL beginning
          with version 5.0.2, with further development planned in MySQL
          5.1. See <a href="triggers.html" title="Chapter 18. Triggers">Chapter 18, <i>Triggers</i></a>.
        </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="ansi-diff-foreign-keys"></a>1.8.5.5. Foreign Keys</h4></div></div></div><a class="indexterm" name="id2765957"></a><a class="indexterm" name="id2765964"></a><p>
          In MySQL Server 3.23.44 and up, the <code class="literal">InnoDB</code>
          storage engine supports checking of foreign key constraints,
          including <code class="literal">CASCADE</code>, <code class="literal">ON
          DELETE</code>, and <code class="literal">ON UPDATE</code>. See
          <a href="storage-engines.html#innodb-foreign-key-constraints" title="14.2.6.4. FOREIGN KEY Constraints">Section 14.2.6.4, “<code class="literal">FOREIGN KEY</code> Constraints”</a>.
        </p><p>
          For storage engines other than <code class="literal">InnoDB</code>,
          MySQL Server parses the <code class="literal">FOREIGN KEY</code> syntax
          in <code class="literal">CREATE TABLE</code> statements, but does not
          use or store it. In the future, the implementation will be
          extended to store this information in the table specification
          file so that it may be retrieved by
          <span><strong class="command">mysqldump</strong></span> and ODBC. At a later stage,
          foreign key constraints will be implemented for
          <code class="literal">MyISAM</code> tables as well.
        </p><p>
          Foreign key enforcement offers several benefits to database
          developers:
        </p><div class="itemizedlist"><ul type="disc"><li><p>
              Assuming proper design of the relationships, foreign key
              constraints make it more difficult for a programmer to
              introduce an inconsistency into the database.
            </p></li><li><p>
              Centralized checking of constraints by the database server
              makes it unnecessary to perform these checks on the
              application side. This eliminates the possibility that
              different applications may not all check the constraints
              in the same way.
            </p></li><li><p>
              Using cascading updates and deletes can simplify the
              application code.
            </p></li><li><p>
              Properly designed foreign key rules aid in documenting
              relationships between tables.
            </p></li></ul></div><p>
          Do keep in mind that these benefits come at the cost of
          additional overhead for the database server to perform the
          necessary checks. Additional checking by the server affects
          performance, which for some applications may be sufficiently
          undesirable as to be avoided if possible. (Some major
          commercial applications have coded the foreign-key logic at
          the application level for this reason.)
        </p><p>
          MySQL gives database developers the choice of which approach
          to use. If you don't need foreign keys and want to avoid the
          overhead associated with enforcing referential integrity, you
          can choose another table type instead, such as
          <code class="literal">MyISAM</code>. (For example, the
          <code class="literal">MyISAM</code> storage engine offers very fast
          performance for applications that perform only
          <code class="literal">INSERT</code> and <code class="literal">SELECT</code>
          operations, because the inserts can be performed concurrently
          with retrievals. See <a href="optimization.html#table-locking" title="7.3.2. Table Locking Issues">Section 7.3.2, “Table Locking Issues”</a>.)
        </p><p>
          If you choose not to take advantage of referential integrity
          checks, keep the following considerations in mind:
        </p><div class="itemizedlist"><ul type="disc"><li><p>
              In the absence of server-side foreign key relationship
              checking, the application itself must handle relationship
              issues. For example, it must take care to insert rows into
              tables in the proper order, and to avoid creating orphaned
              child records. It must also be able to recover from errors
              that occur in the middle of multiple-record insert
              operations.
            </p></li><li><p>
              If <code class="literal">ON DELETE</code> is the only referential
              integrity capability an application needs, note that as of
              MySQL Server 4.0, you can use multiple-table
              <code class="literal">DELETE</code> statements to delete rows from
              many tables with a single statement. See
              <a href="sql-syntax.html#delete" title="13.2.1. DELETE Syntax">Section 13.2.1, “<code class="literal">DELETE</code> Syntax”</a>.
            </p></li><li><p>
              A workaround for the lack of <code class="literal">ON DELETE</code>
              is to add the appropriate <code class="literal">DELETE</code>
              statement to your application when you delete records from
              a table that has a foreign key. In practice, this is often
              as quick as using foreign keys, and is more portable.
            </p></li></ul></div><p>
          Be aware that the use of foreign keys can in some instances
          lead to problems:
        </p><div class="itemizedlist"><ul type="disc"><li><p>
              Foreign key support addresses many referential integrity
              issues, but it is still necessary to design key
              relationships carefully to avoid circular rules or
              incorrect combinations of cascading deletes.
            </p></li><li><p>
              It is not uncommon for a DBA to create a topology of
              relationships that makes it difficult to restore
              individual tables from a backup. (MySQL alleviates this
              difficulty by allowing you to temporarily disable foreign
              key checks when reloading a table that depends on other
              tables. See
              <a href="storage-engines.html#innodb-foreign-key-constraints" title="14.2.6.4. FOREIGN KEY Constraints">Section 14.2.6.4, “<code class="literal">FOREIGN KEY</code> Constraints”</a>. As of
              MySQL 4.1.1, <span><strong class="command">mysqldump</strong></span> generates dump
              files that take advantage of this capability automatically
              when reloaded.)
            </p></li></ul></div><p>
          Note that foreign keys in SQL are used to check and enforce
          referential integrity, not to join tables. If you want to get
          results from multiple tables from a <code class="literal">SELECT</code>
          statement, you do this by performing a join between them:
        </p><pre class="programlisting">SELECT * FROM t1, t2 WHERE t1.id = t2.id;
</pre><p>
          See <a href="sql-syntax.html#join" title="13.2.7.1. JOIN Syntax">Section 13.2.7.1, “<code class="literal">JOIN</code> Syntax”</a>. See
          <a href="tutorial.html#example-foreign-keys" title="3.6.6. Using Foreign Keys">Section 3.6.6, “Using Foreign Keys”</a>.
        </p><p>
          The <code class="literal">FOREIGN KEY</code> syntax without <code class="literal">ON
          DELETE ...</code> is often used by ODBC applications to
          produce automatic <code class="literal">WHERE</code> clauses.
        </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="ansi-diff-views"></a>1.8.5.6. Views</h4></div></div></div><a class="indexterm" name="id2766292"></a><a class="indexterm" name="id2766298"></a><p>
          Views (including updatable views) are implemented in the 5.0
          version of MySQL Server. Views are available in binary
          releases from 5.0.1 and up. See <a href="views.html" title="Chapter 19. Views">Chapter 19, <i>Views</i></a>.
        </p><p>
          Views are useful for allowing users to access a set of
          relations (tables) as if it were a single table, and limiting
          their access to just that. Views can also be used to restrict
          access to rows (a subset of a particular table). For access
          control to columns, you can also use the sophisticated
          privilege system in MySQL Server. See
          <a href="database-administration.html#privilege-system" title="5.7. The MySQL Access Privilege System">Section 5.7, “The MySQL Access Privilege System”</a>.
        </p><p>
          In designing an implementation of views, our ambitious goal,
          as much as is possible within the confines of SQL, has been
          full compliance with “<span class="quote">Codd's Rule #6</span>” for
          relational database systems: “<span class="quote">All views that are
          theoretically updatable, should in practice also be
          updatable.</span>”
        </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="ansi-diff-comments"></a>1.8.5.7. '<code class="literal">--</code>' as the Start of a Comment</h4></div></div></div><a class="indexterm" name="id2766365"></a><a class="indexterm" name="id2766375"></a><p>
          Some other SQL databases use ‘<code class="option">--</code>’
          to start comments. MySQL Server uses
          ‘<code class="literal">#</code>’ as the start comment
          character. You can also use the C comment style <code class="literal">/*
          this is a comment */</code> with MySQL Server. See
          <a href="language-structure.html#comments" title="9.5. Comment Syntax">Section 9.5, “Comment Syntax”</a>.
        </p><p>
          MySQL Server 3.23.3 and above support the
          ‘<code class="literal">--</code>’ comment style, provided
          the comment is followed by a space (or by a control character
          such as a newline). The requirement for a space is to prevent
          problems with automatically generated SQL queries that have
          used something like the following code, where we automatically
          insert the value of the payment for
          <code class="literal">!payment!</code>:
        </p><pre class="programlisting">UPDATE account SET credit=credit-!payment!
</pre><p>
          Think about what happens if the value of
          <code class="literal">payment</code> is a negative value such as
          <code class="literal">-1</code>:
        </p><pre class="programlisting">UPDATE account SET credit=credit--1
</pre><p>
          <code class="literal">credit--1</code> is a legal expression in SQL, but
          if <code class="literal">--</code> is interpreted as the start of a
          comment, part of the expression is discarded. The result is a
          statement that has a completely different meaning than
          intended:
        </p><pre class="programlisting">UPDATE account SET credit=credit
</pre><p>
          The statement produces no change in value at all! This
          illustrates that allowing comments to start with
          ‘<code class="literal">--</code>’ can have serious
          consequences.
        </p><p>
          Using our implementation of this method of commenting in MySQL
          Server 3.23.3 and up, <code class="literal">credit--1</code> is actually
          safe.
        </p><p>
          Another safe feature is that the <span><strong class="command">mysql</strong></span>
          command-line client removes all lines that start with
          ‘<code class="literal">--</code>’.
        </p><p>
          The following information is relevant only if you are running
          a MySQL version earlier than 3.23.3:
        </p><p>
          If you have an SQL program in a text file that contains
          ‘<code class="literal">--</code>’ comments, you should use
          the <span><strong class="command">replace</strong></span> utility as follows to convert
          the comments to use ‘<code class="literal">#</code>’
          characters:
        </p><pre class="programlisting">shell&gt; <strong class="userinput"><code>replace " --" " #" &lt; text-file-with-funny-comments.sql \</code></strong>
         <strong class="userinput"><code>| mysql <em class="replaceable"><code>db_name</code></em></code></strong>
</pre><p>
          instead of the usual:
        </p><pre class="programlisting">shell&gt; <strong class="userinput"><code>mysql <em class="replaceable"><code>db_name</code></em> &lt; text-file-with-funny-comments.sql</code></strong>
</pre><p>
          You can also edit the command file “<span class="quote">in place</span>” to
          change the ‘<code class="literal">--</code>’ comments to
          ‘<code class="literal">#</code>’ comments:
        </p><pre class="programlisting">shell&gt; <strong class="userinput"><code>replace " --" " #" -- text-file-with-funny-comments.sql</code></strong>
</pre><p>
          Change them back with this command:
        </p><pre class="programlisting">shell&gt; <strong class="userinput"><code>replace " #" " --" -- text-file-with-funny-comments.sql</code></strong>
</pre></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="constraints"></a>1.8.6. How MySQL Deals with Constraints</h3></div></div></div><div class="toc"><dl><dt><span class="section"><a href="introduction.html#constraint-primary-key">1.8.6.1. <code class="literal">PRIMARY KEY</code> and <code class="literal">UNIQUE</code> Index Constraints</a></span></dt><dt><span class="section"><a href="introduction.html#constraint-invalid-data">1.8.6.2. Constraints on Invalid Data</a></span></dt><dt><span class="section"><a href="introduction.html#constraint-enum">1.8.6.3. <code class="literal">ENUM</code> and <code class="literal">SET</code> Constraints</a></span></dt></dl></div><a class="indexterm" name="id2766613"></a><p>
        MySQL allows you to work both with transactional tables that
        allow rollback and with non-transactional tables that do not.
        Because of this, constraint handling is a bit different in MySQL
        than in other DBMSs. We must handle the case when you have
        inserted or updated a lot of rows in a non-transactional table
        for which changes cannot be rolled back when an error occurs.
      </p><p>
        The basic philosophy is that MySQL Server tries to produce an
        error for anything that it can detect while parsing a statement
        to be executed, and tries to recover from any errors that occur
        while executing the statement. We do this in most cases, but not
        yet for all.

        

      </p><p>
        The options MySQL has when an error occurs are to stop the
        statement in the middle or to recover as well as possible from
        the problem and continue. By default, the server follows the
        latter course. This means, for example, that the server may
        coerce illegal values to the closest legal values.
      </p><p>
        Beginning with MySQL 5.0.2, several SQL mode options are
        available to provide greater control over how accepting to be of
        bad data values and whether to continue executing a statement or
        abort it when errors occur. Using these options, you can
        configure MySQL Server to act in a more traditional fashion that
        is like other DBMSs that reject improper input. The SQL mode can
        be set at runtime, which enables individual clients to select
        the behavior most appropriate for their requirements. See
        <a href="database-administration.html#server-sql-mode" title="5.3.2. The Server SQL Mode">Section 5.3.2, “The Server SQL Mode”</a>.
      </p><p>
        The following sections describe what happens for the different
        types of constraints.
      </p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="constraint-primary-key"></a>1.8.6.1. <code class="literal">PRIMARY KEY</code> and <code class="literal">UNIQUE</code> Index Constraints</h4></div></div></div><a class="indexterm" name="id2756094"></a><a class="indexterm" name="id2756104"></a><a class="indexterm" name="id2756114"></a><p>
          Normally, an error occurs when you try to
          <code class="literal">INSERT</code> or <code class="literal">UPDATE</code> a row
          that causes a primary key, unique key, or foreign key
          violation. If you are using a transactional storage engine
          such as <code class="literal">InnoDB</code>, MySQL automatically rolls
          back the statement. If you are using a non-transactional
          storage engine, MySQL stops processing the statement at the
          row for which the error occurred and leaves any remaining rows
          unprocessed.
        </p><p>
          If you wish to ignore such key violations, MySQL supports an
          <code class="literal">IGNORE</code> keyword for
          <code class="literal">INSERT</code> and <code class="literal">UPDATE</code>. In
          this case, MySQL ignores any key violations and continues
          processing with the next row. See <a href="sql-syntax.html#insert" title="13.2.4. INSERT Syntax">Section 13.2.4, “<code class="literal">INSERT</code> Syntax”</a>.
          See <a href="sql-syntax.html#update" title="13.2.10. UPDATE Syntax">Section 13.2.10, “<code class="literal">UPDATE</code> Syntax”</a>.
        </p><p>
          You can get information about the number of rows actually
          inserted or updated with the <code class="literal">mysql_info()</code> C
          API function. See <a href="apis.html#mysql-info" title="22.2.3.34. mysql_info()">Section 22.2.3.34, “<code class="literal">mysql_info()</code>”</a>. In MySQL 4.1
          and up, you also can use the <code class="literal">SHOW WARNINGS</code>
          statement. See <a href="sql-syntax.html#show-warnings" title="13.5.4.22. SHOW WARNINGS Syntax">Section 13.5.4.22, “<code class="literal">SHOW WARNINGS</code> Syntax”</a>.
        </p><p>
          For the moment, only <code class="literal">InnoDB</code> tables support
          foreign keys. See
          <a href="storage-engines.html#innodb-foreign-key-constraints" title="14.2.6.4. FOREIGN KEY Constraints">Section 14.2.6.4, “<code class="literal">FOREIGN KEY</code> Constraints”</a>. Foreign key
          support in <code class="literal">MyISAM</code> tables is scheduled for
          implementation in MySQL 5.1.
        </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="constraint-invalid-data"></a>1.8.6.2. Constraints on Invalid Data</h4></div></div></div><a class="indexterm" name="id2766968"></a><a class="indexterm" name="id2766978"></a><a class="indexterm" name="id2766988"></a><a class="indexterm" name="id2766998"></a><a class="indexterm" name="id2767008"></a><p>
          Before MySQL 5.0.2, MySQL is forgiving of illegal or improper
          data values and coerces them to legal values for data entry.
          In MySQL 5.0.2 and up, that remains the default behavior, but
          you can select more traditional treatment of bad values such
          that the server rejects them and aborts the statement in which
          they occur. This section describes the default (forgiving)
          behavior of MySQL, as well as the newer strict SQL mode and
          how it differs.
        </p><p>
          The following holds true when you are not using strict mode.
          If you insert an “<span class="quote">incorrect</span>” value into a column,
          such as a <code class="literal">NULL</code> into a <code class="literal">NOT
          NULL</code> column or a too-large numeric value into a
          numeric column, MySQL sets the column to the “<span class="quote">best
          possible value</span>” instead of producing an error:
        </p><div class="itemizedlist"><ul type="disc"><li><p>
              If you try to store an out of range value in a numeric
              column, MySQL Server instead stores zero, the smallest
              possible value, or the largest possible value in the
              column.
            </p></li><li><p>
              For strings, MySQL stores either the empty string or as
              much of the string as can be stored in the column.
            </p></li><li><p>
              If you try to store a string that doesn't start with a
              number into a numeric column, MySQL Server stores 0.
            </p></li><li><p>
              MySQL allows you to store certain incorrect date values
              into <code class="literal">DATE</code> and
              <code class="literal">DATETIME</code> columns (such as
              <code class="literal">'2000-02-31'</code> or
              <code class="literal">'2000-02-00'</code>). The idea is that it's
              not the job of the SQL server to validate dates. If MySQL
              can store a date value and retrieve exactly the same
              value, MySQL stores it as given. If the date is totally
              wrong (outside the server's ability to store it), the
              special date value <code class="literal">'0000-00-00'</code> is
              stored in the column instead.
            </p></li><li><p>
              If you try to store <code class="literal">NULL</code> into a column
              that doesn't take <code class="literal">NULL</code> values, an error
              occurs for single-row <code class="literal">INSERT</code>
              statements. For multiple-row <code class="literal">INSERT</code>
              statements or for <code class="literal">INSERT INTO ...
              SELECT</code> statements, MySQL Server stores the
              implicit default value for the column data type. In
              general, this is <code class="literal">0</code> for numeric types,
              the empty string (<code class="literal">''</code>) for string types,
              and the “<span class="quote">zero</span>” value for date and time types.
              Implicit default values are discussed in
              <a href="sql-syntax.html#create-table" title="13.1.5. CREATE TABLE Syntax">Section 13.1.5, “<code class="literal">CREATE TABLE</code> Syntax”</a>.
            </p></li><li><p>
              If an <code class="literal">INSERT</code> statement specifies no
              value for a column, MySQL inserts its default value if the
              column definition includes an explicit
              <code class="literal">DEFAULT</code> clause. If the definition has
              no such <code class="literal">DEFAULT</code> clause, MySQL inserts
              the implicit default value for the column data type.
            </p></li></ul></div><p>
          The reason for the preceding rules is that we can't check
          these conditions until the statement has begun executing. We
          can't just roll back if we encounter a problem after updating
          a few rows, because the storage engine may not support
          rollback. The option of terminating the statement is not that
          good; in this case, the update would be “<span class="quote">half
          done,</span>” which is probably the worst possible scenario.
          In this case, it's better to “<span class="quote">do the best you
          can</span>” and then continue as if nothing happened.
        </p><p>
          In MySQL 5.0.2 and up, you can select stricter treatment of
          input values by using the
          <code class="literal">STRICT_TRANS_TABLES</code> or
          <code class="literal">STRICT_ALL_TABLES</code> SQL modes. See
          <a href="database-administration.html#server-sql-mode" title="5.3.2. The Server SQL Mode">Section 5.3.2, “The Server SQL Mode”</a>.
        </p><p>
          <code class="literal">STRICT_TRANS_TABLES</code> works like this:
        </p><div class="itemizedlist"><ul type="disc"><li><p>
              For transactional storage engines, bad data values
              occurring anywhere in the statement cause the statement to
              abort and roll back.
            </p></li><li><p>
              For non-transactional storage engines, the statement
              aborts if the error occurs in the first row to be inserted
              or updated. (In this case, the statement can be regarded
              to leave the table unchanged, just as for a transactional
              table.) Errors in rows after the first do not abort the
              statement. Instead, bad data values are adjusted and
              result in warnings rather than errors. In other words,
              with <code class="literal">STRICT_TRANS_TABLES</code>, a wrong value
              causes MySQL to roll back, if it can, all updates done so
              far.
            </p></li></ul></div><p>
          For stricter checking, enable
          <code class="literal">STRICT_ALL_TABLES</code>. This is the same as
          <code class="literal">STRICT_TRANS_TABLES</code> except that for
          non-transactional storage engines, errors abort the statement
          even for bad data in rows following the first row. This means
          that if an error occurs partway through a multiple-row insert
          or update for a non-transactional table, a partial update
          results. Earlier rows are inserted or updated, but those from
          the point of the error on are not. To avoid this for
          non-transactional tables, either use single-row statements or
          else use <code class="literal">STRICT_TRANS_TABLES</code> if conversion
          warnings rather than errors are acceptable. To avoid problems
          in the first place, do not use MySQL to check column content.
          It is safest (and often faster) to let the application ensure
          that it passes only legal values to the database.
        </p><p>
          With either of the strict mode options, you can cause errors
          to be treated as warnings by using <code class="literal">INSERT
          IGNORE</code> or <code class="literal">UPDATE IGNORE</code> rather
          than <code class="literal">INSERT</code> or <code class="literal">UPDATE</code>
          without <code class="literal">IGNORE</code>.
        </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="constraint-enum"></a>1.8.6.3. <code class="literal">ENUM</code> and <code class="literal">SET</code> Constraints</h4></div></div></div><p>
          <code class="literal">ENUM</code> and <code class="literal">SET</code> columns
          provide an efficient way to define columns that can contain
          only a given set of values. However, before MySQL 5.0.2,
          <code class="literal">ENUM</code> and <code class="literal">SET</code> are not
          real constraints. This is for the same reasons that
          <code class="literal">NOT NULL</code> is not honored. See
          <a href="introduction.html#constraint-invalid-data" title="1.8.6.2. Constraints on Invalid Data">Section 1.8.6.2, “Constraints on Invalid Data”</a>.
        </p><p>
          <code class="literal">ENUM</code> columns always have a default value.
          If you don't specify a default value, then it is
          <code class="literal">NULL</code> for columns that can have
          <code class="literal">NULL</code>, otherwise the first enumeration value
          is used as the default value.
        </p><p>
          If you insert an incorrect value into an
          <code class="literal">ENUM</code> column or if you force a value into an
          <code class="literal">ENUM</code> column with <code class="literal">IGNORE</code>,
          it is set to the reserved enumeration value of
          <code class="literal">0</code>, which is displayed as an empty string in
          string context. See <a href="column-types.html#enum" title="11.4.4. The ENUM Type">Section 11.4.4, “The <code class="literal">ENUM</code> Type”</a>.
        </p><p>
          If you insert an incorrect value into a <code class="literal">SET</code>
          column, the incorrect value is ignored. For example, if the
          column can contain the values <code class="literal">'a'</code>,
          <code class="literal">'b'</code>, and <code class="literal">'c'</code>, an attempt
          to assign <code class="literal">'a,x,b,y'</code> results in a value of
          <code class="literal">'a,b'</code>. See <a href="column-types.html#set" title="11.4.5. The SET Type">Section 11.4.5, “The <code class="literal">SET</code> Type”</a>.
        </p><p>
          As of MySQL 5.0.2, you can configure the server to use strict
          SQL mode. See <a href="database-administration.html#server-sql-mode" title="5.3.2. The Server SQL Mode">Section 5.3.2, “The Server SQL Mode”</a>. When strict
          mode is enabled, the definition of a <code class="literal">ENUM</code>
          or <code class="literal">SET</code> column does act as a constraint on
          values entered into the column. An error occurs for values
          that do not satisfy these conditions:
        </p><div class="itemizedlist"><ul type="disc"><li><p>
              An <code class="literal">ENUM</code> value must be one of those
              listed in the column definition, or the internal numeric
              equivalent thereof. The value cannot be the error value
              (that is, 0 or the empty string). For a column defined as
              <code class="literal">ENUM('a','b','c')</code>, values such as
              <code class="literal">''</code>, <code class="literal">'d'</code>, and
              <code class="literal">'ax'</code> are illegal and are rejected.
            </p></li><li><p>
              A <code class="literal">SET</code> value must be the empty string or
              a value consisting of one or more of the values listed in
              the column definition separated by commas. For a column
              defined as <code class="literal">SET('a','b','c')</code>, values
              such as <code class="literal">'d'</code>, and
              <code class="literal">'a,b,c,d'</code> are illegal and are rejected.
            </p></li></ul></div><p>
          Errors for invalid values can be suppressed in strict mode if
          you use <code class="literal">INSERT IGNORE</code> or <code class="literal">UPDATE
          IGNORE</code>. In this case, a warning is generated rather
          than an error. For <code class="literal">ENUM</code>, the value is
          inserted as the error member (<code class="literal">0</code>). For
          <code class="literal">SET</code>, the value is inserted as given except
          that any invalid substrings are deleted. For example,
          <code class="literal">'a,x,b,y'</code> results in a value of
          <code class="literal">'a,b'</code>, as described earlier.
        </p></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="preface.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="installing.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Preface </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 2. Installing MySQL</td></tr></table></div></body></html>