<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Mysql on phjhq's Blog</title><link>https://houjinghao123.github.io/tags/mysql/</link><description>Recent content in Mysql on phjhq's Blog</description><image><title>phjhq's Blog</title><url>https://i.postimg.cc/7hwBy7VS/calcr.png</url><link>https://i.postimg.cc/7hwBy7VS/calcr.png</link></image><generator>Hugo -- 0.134.1</generator><language>zh</language><copyright>©2024 phjhq&amp;rsquo;s Blog</copyright><lastBuildDate>Sun, 29 Sep 2024 17:34:22 +0800</lastBuildDate><atom:link href="https://houjinghao123.github.io/tags/mysql/index.xml" rel="self" type="application/rss+xml"/><item><title>MySQL触发器</title><link>https://houjinghao123.github.io/posts/mysql%E8%A7%A6%E5%8F%91%E5%99%A8/</link><pubDate>Sun, 29 Sep 2024 17:34:22 +0800</pubDate><guid>https://houjinghao123.github.io/posts/mysql%E8%A7%A6%E5%8F%91%E5%99%A8/</guid><description>&lt;h1 id="触发器">&lt;strong>触发器&lt;/strong>&lt;/h1>
&lt;h2 id="1介绍">&lt;strong>1.介绍&lt;/strong>&lt;/h2>
&lt;p>触发器是与表有关的数据库对象，指在insert/update/delete之前(BEFORE)或之后(AFTER)，触发并执行触发器中定义的SQL语句集合。&lt;/p></description></item><item><title>MySQL视图和存储过程</title><link>https://houjinghao123.github.io/posts/%E8%A7%86%E5%9B%BE%E5%92%8C%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B/</link><pubDate>Sun, 29 Sep 2024 15:21:23 +0800</pubDate><guid>https://houjinghao123.github.io/posts/%E8%A7%86%E5%9B%BE%E5%92%8C%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B/</guid><description>&lt;h1 id="视图-存储过程">&lt;strong>视图-存储过程&lt;/strong>&lt;/h1>
&lt;h2 id="一视图">&lt;strong>一、视图&lt;/strong>&lt;/h2>
&lt;h3 id="11介绍">&lt;strong>1.1介绍&lt;/strong>&lt;/h3>
&lt;p>视图（View）是一种虚拟存在的表。视图中的数据并不在数据库中实际存在，行和列数据来自定义视图的查询中使用的表，并且是在使用视图时动态生成的。&lt;/p></description></item><item><title>SQL优化</title><link>https://houjinghao123.github.io/posts/sql%E4%BC%98%E5%8C%96/</link><pubDate>Fri, 27 Sep 2024 09:13:15 +0800</pubDate><guid>https://houjinghao123.github.io/posts/sql%E4%BC%98%E5%8C%96/</guid><description>&lt;h1 id="sql优化">&lt;strong>SQL优化&lt;/strong>&lt;/h1>
&lt;h2 id="插入数据">&lt;strong>插入数据&lt;/strong>&lt;/h2>
&lt;h3 id="insert">&lt;strong>insert&lt;/strong>&lt;/h3>
&lt;p>假设我们需要插入大量数据，那么有哪些方法呢？&lt;/p>
&lt;ul>
&lt;li>批量插入数据&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-mysql" data-lang="mysql">&lt;span class="line">&lt;span class="ln">1&lt;/span>&lt;span class="cl">&lt;span class="k">INSERT&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="k">INTO&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">tb_test&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="k">values&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="mi">1&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="s1">&amp;#39;Tom&amp;#39;&lt;/span>&lt;span class="p">),(&lt;/span>&lt;span class="mi">2&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="s1">&amp;#39;Cat&amp;#39;&lt;/span>&lt;span class="p">),(&lt;/span>&lt;span class="mi">3&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="s1">&amp;#39;Jerry&amp;#39;&lt;/span>&lt;span class="p">);&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pr</description></item><item><title>Mysql存储引擎</title><link>https://houjinghao123.github.io/posts/mysql%E5%BC%95%E6%93%8E%E4%BB%8B%E7%BB%8D/</link><pubDate>Sat, 21 Sep 2024 14:04:10 +0800</pubDate><guid>https://houjinghao123.github.io/posts/mysql%E5%BC%95%E6%93%8E%E4%BB%8B%E7%BB%8D/</guid><description>&lt;h1 id="一mysql存储引擎">&lt;strong>一、Mysql存储引擎&lt;/strong>&lt;/h1>
&lt;h2 id="1mysql的体系结构">&lt;strong>1.Mysql的体系结构&lt;/strong>&lt;/h2>
&lt;p>&lt;img loading="lazy" src="https://i.postimg.cc/MpV3xV4W/screenshot-16.png" alt="" />
&lt;/p>
&lt;ol>
&lt;li>连接层&lt;/li>
&lt;li>服务层&lt;/li>
&lt;li>引擎层&lt;/li>
&lt;li>存储层&lt;/li>
&lt;/ol>
&lt;h2 id="2存储引擎介绍">&lt;strong>2.存储引擎介绍&lt;/strong>&lt;/h2>
&lt;p>存储引擎就是存储数据、建立索引、更新/查询数据等技术的实现方式 。存储引擎是基于表的，而不是基于库的，&lt;code>所以存储引擎也可被称为表类型&lt;/code> 。我们可以在创建表的时候，来指定选择的存储引擎，如果没有指定将自动选择默认的存储引擎(InnoDB)。&lt;/p></description></item><item><title>Mysql事务</title><link>https://houjinghao123.github.io/posts/mysql%E4%BA%8B%E5%8A%A1/</link><pubDate>Fri, 20 Sep 2024 14:04:10 +0800</pubDate><guid>https://houjinghao123.github.io/posts/mysql%E4%BA%8B%E5%8A%A1/</guid><description>&lt;h1 id="事务">事务&lt;/h1>
&lt;p>事务 是一组操作的集合，它是一个不可分割的工作单位，事务会把所有的操作作为一个整体一起向系统提交或撤销操作请求，即这些操作要么同时成功，要么同时失败。&lt;/p></description></item><item><title>Mysql常用函数</title><link>https://houjinghao123.github.io/posts/mysql%E5%B8%B8%E7%94%A8%E5%87%BD%E6%95%B0/</link><pubDate>Thu, 19 Sep 2024 20:02:09 +0800</pubDate><guid>https://houjinghao123.github.io/posts/mysql%E5%B8%B8%E7%94%A8%E5%87%BD%E6%95%B0/</guid><description>&lt;h1 id="mysql常用函数">Mysql常用函数&lt;/h1>
&lt;p>&lt;img src="https://i.postimg.cc/cJQ332yQ/screenshot-12.png" />&lt;br>&lt;/p>
&lt;h2 id="聚合函数">&lt;strong>聚合函数&lt;/strong>&lt;/h2>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">函数&lt;/th>
&lt;th style="text-align: left">功能&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">count&lt;/td>
&lt;td style="text-align: left">统计数量&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">max&lt;/td>
&lt;td style="text-align: left">最大值&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">min&lt;/td>
&lt;td style="text-align: left">最小值&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">avg&lt;/td>
&lt;td style="text-align: left">平均值&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">sum&lt;/td>
&lt;td style="text-align: left">求和&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h2 id="字符串函数">&lt;strong>字符串函数&lt;/strong>&lt;/h2>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">函数&lt;/th>
&lt;th style="text-align: left">功能&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">CONCAT(S1,S2,&amp;hellip;Sn)&lt;/td>
&lt;td style="text-align: left">字符串拼接，将S1，S2，&amp;hellip; Sn拼接成一个字符串&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">LOWER(str)&lt;/td>
&lt;td style="text-align: left">将字符串str全部转为小写&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">UPPER(str)&lt;/td>
&lt;td style="text-align: left">将字符串str全部转为大写&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">LPAD(str,n,pad)&lt;/td>
&lt;td style="text-align: left">左填充，用字符串pad对str的左边进行填充，达到n个字符串长度&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">RPAD(str,n,pad)&lt;/td>
&lt;td style="text-align: left">右填充，用字符串pad对str的右边进行填充，达到n个字符串长度&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">TRIM(str)&lt;/td>
&lt;td style="text-align: left">去掉字符串头部和尾部的空格&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">SUBSTRING(str,start,len)&lt;/td>
&lt;td style="text-align: left">返回从字符串str从start位置起的len个长度的字符串&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h2 id="数值函数">&lt;strong>数值函数&lt;/strong>&lt;/h2>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">函数&lt;/th>
&lt;th style="text-align: left">功能&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">CEIL(x)&lt;/td>
&lt;td style="text-align: left">向上取整&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">FLOOR(x)&lt;/td>
&lt;td style="text-align: left">向下取整&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">MOD(x,y)&lt;/td>
&lt;td style="text-align: left">返回x/y的模&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">RAND()&lt;/td>
&lt;td style="text-align: left">返回0~1内的随机数&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">ROUND(x,y)&lt;/td>
&lt;td style="text-align: left">求参数x的四舍五入的值，保留y位小数&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>例题：&lt;br>
通过数据库的函数，生成一个六位数的随机验证码。&lt;/p></description></item><item><title>MySQL的基本操作</title><link>https://houjinghao123.github.io/posts/my-first-post/</link><pubDate>Tue, 10 Sep 2024 16:55:14 +0800</pubDate><guid>https://houjinghao123.github.io/posts/my-first-post/</guid><description>&lt;h1 id="mysql的基本操作">MySQL的基本操作&lt;/h1>
&lt;p>1、查看所有的数据库&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-mysql" data-lang="mysql">&lt;span class="line">&lt;span class="ln">1&lt;/span>&lt;span class="cl">&lt;span class="k">show&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">datebases&lt;/span>&lt;span class="p">;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>2、创建自己的数据库&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-mysql" data-lang="mysql">&lt;span class="line">&lt;span class="ln">1&lt;/span>&lt;span class="cl">&lt;span class="k">create&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">datebase&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="err">数据库名字&lt;/span>&lt;span class="p">;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pr</description></item><item><title>测试</title><link>https://houjinghao123.github.io/java/%E6%B5%8B%E8%AF%95%E7%94%A8/</link><pubDate>Tue, 10 Sep 2024 16:55:14 +0800</pubDate><guid>https://houjinghao123.github.io/java/%E6%B5%8B%E8%AF%95%E7%94%A8/</guid><description/></item></channel></rss>