<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://kb.unixservertech.com/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://kb.unixservertech.com/feed.php">
        <title>Unix Server Tech Knowledge Base - software:mysql</title>
        <description></description>
        <link>https://kb.unixservertech.com/</link>
        <image rdf:resource="https://kb.unixservertech.com/_media/wiki/dokuwiki.svg" />
       <dc:date>2026-05-12T21:06:41+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://kb.unixservertech.com/software/mysql/altering_tables?rev=1601081773&amp;do=diff"/>
                <rdf:li rdf:resource="https://kb.unixservertech.com/software/mysql/pivots?rev=1668056866&amp;do=diff"/>
                <rdf:li rdf:resource="https://kb.unixservertech.com/software/mysql/tuning?rev=1668056939&amp;do=diff"/>
                <rdf:li rdf:resource="https://kb.unixservertech.com/software/mysql/withrecursive?rev=1770437129&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://kb.unixservertech.com/_media/wiki/dokuwiki.svg">
        <title>Unix Server Tech Knowledge Base</title>
        <link>https://kb.unixservertech.com/</link>
        <url>https://kb.unixservertech.com/_media/wiki/dokuwiki.svg</url>
    </image>
    <item rdf:about="https://kb.unixservertech.com/software/mysql/altering_tables?rev=1601081773&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-09-26T00:56:13+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Altering Tables</title>
        <link>https://kb.unixservertech.com/software/mysql/altering_tables?rev=1601081773&amp;do=diff</link>
        <description>Altering Tables

Adding a column

To add a column if it does not exist you can do a Prepare/Execute function as follows:


SET @dbname = DATABASE();
SET @tablename = &quot;tableName&quot;;
SET @columnname = &quot;colName&quot;;
SET @preparedStatement = (SELECT IF(
  (
    SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
    WHERE
      (table_name = @tablename)
      AND (table_schema = @dbname)
      AND (column_name = @columnname)
  ) &gt; 0,
  &quot;SELECT 1&quot;,
  CONCAT(&quot;ALTER TABLE &quot;, @tablename, &quot; ADD &quot;, @columnname, &quot; …</description>
    </item>
    <item rdf:about="https://kb.unixservertech.com/software/mysql/pivots?rev=1668056866&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-11-10T05:07:46+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Create a pivot result in mariadb/mysql</title>
        <link>https://kb.unixservertech.com/software/mysql/pivots?rev=1668056866&amp;do=diff</link>
        <description>Create a pivot result in mariadb/mysql

This relies heavily on &lt;https://stackoverflow.com/questions/15997090/crosstab-view-in-mysql&gt; and I even stole the data structure. I just worked to figure out what was going on, then wrote this up. NOTE: it is possible I made a mistake in my interpretation. If so, it is all on me.</description>
    </item>
    <item rdf:about="https://kb.unixservertech.com/software/mysql/tuning?rev=1668056939&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-11-10T05:08:59+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>mariaDB/mySQL Tuning</title>
        <link>https://kb.unixservertech.com/software/mysql/tuning?rev=1668056939&amp;do=diff</link>
        <description>mariaDB/mySQL Tuning

mySQL and mariaDB come stock with a few defaults, but sometimes it is better to modify them yourself to tune the system more to your usage.

Following is based on a stand alone server with 16G of memory. The system is a central repository for multiple machines, so it needs to be accessible to other machines in the network.</description>
    </item>
    <item rdf:about="https://kb.unixservertech.com/software/mysql/withrecursive?rev=1770437129&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2026-02-07T04:05:29+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>The WITH RECURSIVE syntax</title>
        <link>https://kb.unixservertech.com/software/mysql/withrecursive?rev=1770437129&amp;do=diff</link>
        <description>The WITH RECURSIVE syntax

Using FrontAccounting, I needed a way to project recurring revenue for the next 12 months. I had a combination of a Perl script and a MySQL query to do this, but I wanted a single query that I could plug into my report tool.

Warnings

Just like it says, this is recursion, generally used to retrieve data from a hierarchical configuration.</description>
    </item>
</rdf:RDF>
