-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.xml
61 lines (40 loc) · 26.5 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Learn Practice Change</title>
<link href="/atom.xml" rel="self"/>
<link href="https://why666.github.io/"/>
<updated>2018-12-15T06:41:18.993Z</updated>
<id>https://why666.github.io/</id>
<author>
<name>Andy_Wu</name>
</author>
<generator uri="http://hexo.io/">Hexo</generator>
<entry>
<title></title>
<link href="https://why666.github.io/2018/12/15/sql/"/>
<id>https://why666.github.io/2018/12/15/sql/</id>
<published>2018-12-15T06:41:18.993Z</published>
<updated>2018-12-15T06:41:18.993Z</updated>
<content type="html"><![CDATA[<p>数据查询功能:</p><pre><code>Select <目标列名序列( 需要的列 )> from <数据源( 表格 )>[where<检索条件表达式>][Group by <分组依据列>][having <组提取条件>][order by <排序依据列>]</code></pre><a id="more"></a><p>学生表(student)</p><p><img src="https://segmentfault.com/img/bV7dyD" alt="clipboard.png"></p><p>课程表(course)</p><p><img src="https://segmentfault.com/img/bV7dAn?w=307&h=182" alt="clipboard.png"></p><p>成绩表(sc)</p><p><img src="https://segmentfault.com/img/bV7oNA?w=212&h=388" alt="clipboard.png"></p><p><strong>1.</strong>查询指定的列</p><pre><code>select Sno ,Sname,sdept From Student</code></pre><p><img src="https://segmentfault.com/img/bV7dDL?w=238&h=234" alt="clipboard.png"></p><p><strong>2.</strong>查询全部列</p><pre><code>select * from Student</code></pre><p>、<br><img src="https://segmentfault.com/img/bV7dED?w=358&h=235" alt="clipboard.png"></p><p><strong>3.</strong>根据已知参数查询</p><pre><code>select Sname ,'生日',2018 - Sage from Student</code></pre><p><img src="https://segmentfault.com/img/bV7dFl?w=261&h=227" alt="clipboard.png"></p><p><strong>4.</strong>指定列的别名</p><pre><code>列名|表达式 [AS] 列别名 或者 列别名=列名|表达式select Sname ,'生日' as 常量列 ,2018 - Sage as 年份 from Student</code></pre><p><img src="https://segmentfault.com/img/bV7dFt?w=220&h=229" alt="clipboard.png"></p><p><strong>5.</strong>去除重复列</p><pre><code>select distinct Sno from sc</code></pre><p><img src="https://segmentfault.com/img/bV7dF9?w=123&h=98" alt="clipboard.png"></p><p><strong>6.</strong>查询满足条件的元组</p><p>关键字(WHERE)</p><pre><code>select Sname from Student Where Sdept ='计算机系'</code></pre><p><img src="https://segmentfault.com/img/bV7dK9?w=106&h=101" alt="clipboard.png"></p><pre><code>select Sname,Sage from Student Where Sage <20</code></pre><p><img src="https://segmentfault.com/img/bV7dLc?w=159&h=98" alt="clipboard.png"></p><pre><code>select Sname,Sage from Student Where not Sage >=20</code></pre><p><img src="https://segmentfault.com/img/bV7dLc?w=159&h=98" alt="clipboard.png"></p><p>常用的where的查询条件<br><img src="https://segmentfault.com/img/bV7dKh?w=995&h=226" alt="clipboard.png"></p><p><strong>7.</strong>确定范围between ….and和not between….and</p><pre><code>格式:列名|表达式 [NOT] between 下限值 and 上限值(包括边界值) select Sname,Sage,sdept from Student where Sage between 20 and 23(where Sage <20 or Sage>23 ) </code></pre><p><img src="/img/bV7dLr" alt="clipboard.png"></p><p>创建图书表:</p><pre><code>create table book( Number char(8) primary key, BookName char(20) not null, price real not null, data datetime not null ) go</code></pre><p><img src="/img/bV7dPr" alt="clipboard.png"></p><pre><code>select *from bookwhere date between '2009/6/1' and '2009/6/30'</code></pre><p><strong>日期类型的常量要用单引号引起来,而且年,月,日之间通常用分隔符隔开,常用的分隔符有“/”和“-”</strong></p><p><strong>8.</strong>确定集合<br>关键字IN</p><pre><code>select Sname ,Ssexn from Student where Sdept(NOT) IN('信息系','数学系','计算机系')</code></pre><p><img src="/img/bV7dSc" alt="clipboard.png"></p><p><strong>9.</strong>字符串匹配<br>LIKE关键字</p><pre><code>LIKE的通用形式:列名 [NOT] LIKE <匹配串>通配符:_:匹配任意一个字符;%:匹配0个或多个字符;[]:匹配[]当中的任意一个字符[^]:不匹配[]中的任意一个字符</code></pre><p>例如查询姓“张”的学生详细信息</p><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"> <span class="keyword">select</span> * <span class="keyword">from</span> Student <span class="keyword">Where</span> Sname <span class="keyword">Like</span> <span class="string">'张%'</span></span><br><span class="line"> <span class="keyword">select</span> * <span class="keyword">from</span> Student <span class="keyword">Where</span> Sname <span class="keyword">Like</span> <span class="string">'[张李刘]%'</span></span><br><span class="line"> <span class="keyword">select</span> * <span class="keyword">from</span> Student <span class="keyword">Where</span> Sname <span class="keyword">Like</span> <span class="string">'张%'</span> <span class="keyword">OR</span> Sname <span class="keyword">Like</span> <span class="string">'李%'</span></span><br><span class="line">});</span><br></pre></td></tr></table></figure><p><img src="/img/bV7dT4" alt="clipboard.png"></p><p>查询所有不姓‘王’也不姓‘张’的学生的姓名。</p><pre><code class="sql"><span class="keyword">select</span> * <span class="keyword">from</span> Student <span class="keyword">Where</span> Sname <span class="keyword">NOT</span> <span class="keyword">Like</span> <span class="string">'[王张]%'</span> <span class="keyword">where</span> Sanme <span class="keyword">Like</span> <span class="string">'[^王张]%'</span> <span class="keyword">where</span> Sname <span class="keyword">NOT</span> <span class="keyword">LIKE</span> <span class="string">'王%'</span> <span class="keyword">AND</span> Sname <span class="keyword">NOT</span> <span class="keyword">LIKE</span> <span class="string">'张%'</span></code></pre><p> 查询姓“王”且名字是2个字的学生的姓名。</p><pre><code>select Sname from Student Where Sname like '王_'</code></pre><p><img src="/img/bV7d1G" alt="clipboard.png"></p><p> 查询姓“王”且名字是3个字的学生的姓名。</p><pre><code>select Sname from Student Where Sname like '王_ _'</code></pre><p><img src="/img/bV7d1f" alt="clipboard.png"></p><p>如果希望系统在比较时能够去掉尾随空格的干扰可以使用sql去掉尾随空格的函数:rtrim(列名)<br> 因为系统在存储“王敏”时固定的char为10个空间所以还要在其后面添加6个空格也就是6个字符</p><p>改变后的格式:<br> select Sname From Student Where rtrim (Sname) LIKE ‘王__’</p><p>查询学号的最后一位不是2,3,5的学生的信息</p><pre><code>select * from Student where Sno like '%[^235]'</code></pre><p>如果要查找的字符串正好含有通配符,就需要使用一个特殊得转义字符</p><p>escape(‘a’)表示位于a字符后面的字符不是转义字符</p><pre><code>`where fieldl like '%30!%%' Escape '!'` 查询含有30%的字段`where fieldl like '%!_%' Escape '!'` 包含_的字段</code></pre><p><strong>10.</strong>涉及NULL的查询</p><p>判断某个值是否为null值,不能使用普通的比较运算符(=,!= 等)<br>判断列值为空:</p><pre><code>列名 IS NULL</code></pre><p>判断列值为非空:</p><pre><code>列名 IS NOT NULL</code></pre><p>查询所有非空的考试成绩学生的学号,课程号,和成绩:</p><pre><code>select Sno,Cno, From ,Grade from Sc WHERE Grade IS Not NULL</code></pre><p> <strong>11.</strong>多重条件查询<br>关键字and和or(AND的优先级大于OR)</p><pre><code>select Sname FROM Student WHERE Sdept ='计算机系' AND Sage<20</code></pre><p> <strong>这里因为AND的优先级大于OR要用括号进行区分</strong><br> select Sname ,Sdept,Sage from Student where (Sdept =’计算机系’ OR Sdept=’信息系’) AND Sage>=20 </p><p> <strong>也可以用IN语句避免优先级关系</strong><br> select Sname ,Sdept,Sage From Student WHERE Sdept IN(‘计算机系’,’信息系’) AND Sage >=20</p><p><strong>12.</strong>对查询的结果进行排序</p><pre><code>ORDER BY <列名> [ASC|DESC] [,....n](默认的排序方式为升序排列)</code></pre><p>全体学生年龄按升序排列:<br> select <em>from From order by sage ASC<br> 选修c02这门课的学生按降序排列:<br> select Sno ,Grade from SC where cno=’c02’ order by grade DESC<br>查询结果让所在系的系名升序排列,同一系的学生按年龄降序排列:(这个地方的使用注意体会!)<br> select </em> from Student order by Sdept ASC,Sage DESC</p><p><strong>13.</strong>使用聚合函数汇总数据</p><pre><code>count(*):统计表中元组的个数。count([distinct]<列名>):统计本列非空列值个数,distinct表示不包括列的重复值。sum(<列名>):计算列值总和(必须是数值类型)avg(<列名>):计算列值平均值(必须是数值整形)max(<列名>):求列值的最大值min(<列名>):求列值的最小值</code></pre><p> 上面的函数中除了count(*)外,其他函数在计算过程中均忽略NULL再计算(count计算时如果这一行都为null也算一行)</p><p>统计学生总人数:<code>select count(*) from Student</code></p><p>统计了选修课程的学生人数:<code>select count (distinct Sno)from SC(注意一个学生可以选择多门课)</code></p><p>统计’9512101’学生的选课门数和考试总成绩:<code>select count(*) as 选课门数,Sum(Grade)as 总成绩 from SC</code> <code>WHERE Sno ='9512101'</code></p><p> <strong>注意:聚合函数不能出现在where字句当中。</strong><br>例如:<code>select Sname FROM Student where Sage = MAX(Sage)</code>是错误的写法。</p><p><strong>14.</strong>对查询结果进行分组的统计<br>前面所列举的通过聚合函数的例子都是对全表数据进行统计的,有时我们希望计算的精度更高一些,比如统计每个学生的考试平均成绩,而不是全体学生的考试平均成绩,这时就要用到查询语句的分组功能。<br>关键字:GROUP BY</p><ol><li>group by 可以将统计控制在组一级。 分组的目的是为了细化聚合函数的作用对象。</li></ol><ol start="2"><li>在一个查询语句中,可以使用多个列进行分组,需要注意的是如果使用了分组子句,则查询列表的每一个列必须要么是<strong>分组依据列(group by后面的列),要么是聚合函数</strong>。</li></ol><ol start="3"><li>使用group by子句时,如果在select的查询列表中包含聚合函数,则是针对每个组计算出来的一个汇总的值,从而实现对查询结果的分组统计。</li></ol><p>分组子句跟在where子句的后边,一般形式:</p><pre><code>GROUP BY <> [,....][HAVING <组选择条件>]</code></pre><p><strong>注意:分组依据列不能是text,ntext,image,bit类型的列。</strong></p><p> 使用group by子句</p><ol><li><p>统计每门课程的选课人数,列出课程和选课的人数。</p><p> select Cno as 课程号,Count (Sno) as 选课人数</p><pre><code>from SC group by Cno</code></pre></li></ol><p>该语句首先对sc表的数据按Cno的值进行分组,所有具有相同Cno值的元组归为一组,然后再对每一组的元组使用count进行计算,求得每一组的学生的人数。 </p><p><img src="/img/bV7kYi" alt="clipboard.png"></p><p>2.统计每个学生的选课门数和平均成绩</p><pre><code>select Sno 学号,count(*) 选课门数,average (Grade) 平均成绩from sc gropu by Sno</code></pre><p><img src="/img/bV7kZQ" alt="clipboard.png"></p><p>3.统计每个系的学生人数和平均年龄</p><pre><code>select Sno 学号,Count(*) 选课门数 ,avg(Grade) 平均年龄 from Sc group by Sno </code></pre><p><img src="/img/bV7k3b" alt="clipboard.png"></p><p> <strong>总结: 统计哪一列的各种参数就将哪一列进行分组</strong></p><p>4.用带where子句的分组,统计每个系的女生人数和最大年龄。(<strong>按列进行分组然后再按组里面的值有选择的进行运算,而不是直接整组运算可以用where进行修饰</strong>)</p><pre><code>select Sdept ,count(*) 女生人数 from Student where Ssex ='女' group by Sdept </code></pre><p><img src="/img/bV7k5u" alt="clipboard.png"></p><p>5.按多列进行分组,统计每个系的男生人数和女生人数,以及男生的最大年龄和女生的的最大年龄,结果按系命的升序排列。</p><pre><code>select Sdept ,Ssexn ,Count (*) 人数,max(Sage) 最大年龄 from Student Group by Sdept ,Ssexn Order by Sdept </code></pre><p><img src="/img/bV7lb6" alt="clipboard.png"></p><p>6.使用having子句</p><ul><li>having子句用于对分组后的结果在进行筛选,它的功能有点像where子句,但他用于组而不是单个记录。</li><li>在having子句中可以使用统计函数,但在where子句中则不能。</li><li>having通常与group by子句一起使用。</li></ul><p>例:查询选修了3门以上学生学号和选课的门数</p><pre><code>select Sno ,Count(*) 选课的门数 from sc group BY Sno HAVING COUNT(*)>3 </code></pre><p> 先执行group by对Sno进行分组,然后再用统计函数count对每一组的元组个数进行统计,最后找出大于3的那一组。</p><p><img src="/img/bV7oNd" alt="clipboard.png"></p><p>例:查询选课门数大于等于4门的学生的平均成绩和选课门数。</p><pre><code>select Sno,Avg(Grade) 平均成绩,count(*) 选课门数 from sc Group by Snohaving count (*)>=4</code></pre><p><img src="/img/bV7oNn" alt="clipboard.png"></p><p>总结:</p><ul><li>where子句用来筛选from子句中指定的数据元源所产生的行数据。 </li><li>group by 子句用来对经where子句筛选后的结果数据进行分组。 (前面限定where,后面限定having)</li><li>having子句用来对分组后的结果数据再进行筛选</li></ul><p>建议将所有应该分组之前进行的搜索条件放在where子句而不是having子句中,这样写的效率更高一些。</p><p>查询计算机系和信息系的学生人数<br>第一种</p><pre><code>select Sdept ,Count (*) from Student GROUP BY Sdept having Sdept IN('计算机系','信息系')</code></pre><p>第二种</p><pre><code>select Sdept ,Count(*) from Student where Sdept in('计算机系','信息系')group by Sdept</code></pre><p>很显然第二种的效率更高一些。</p><p><strong>但是要注意一点有时候只能用where限定</strong><br>例:查询每个系年龄小于等于20岁的学生的人数。</p><pre><code>select Sdept ,count(*) from Student where Sage <=20 group by Sdept</code></pre><p>注意该语句不可以写成</p><pre><code>select Sdept ,count(*) from Student group by Sdept having Sage <=20</code></pre><p><strong>这里是因为having是在分组统计之后再进行这是只包含分组依据列(系别和人数)所以没有Sage元素。</strong></p><p><strong>15.</strong>多表连接查询<br>1.内连接<br>内连接是一种常用的连接类型,如果两个表的字段满足连接条件,则可以从这两个表里面提取数据并组和成新的记录。</p><p>内连接的语法格式:</p><pre><code>from 表1 [inner] join 表2 ON <连接条件> </code></pre><p>连接条件的一般格式:</p><pre><code>[<表名 1.>] [<列名 1>]<比较运算符> [<表名 2.>][<列名 2>]</code></pre><p>当比较运算符为等号(=)是时,称为等值连接,其他的称为非等值连接。</p><p>例:<br>查询每个学生及其选课的详细信息。</p><pre><code>select * from Student Inner JOIN sc on Student.Sno=sc.Sno</code></pre><p><img src="/img/bV7o00" alt="clipboard.png"></p><p>在写多连接表时有必要将这些重复的列给去掉,方法是在select 子句中直接列出所需要的列名,而不是’*’,另外由于多表连接后,在连接生成的表中可能存在列名相同的列,因此为了明确到底需要哪个列,可以在列名的前面添加表名前缀限制,其格式:<code>表名.列名</code></p><p>去掉上图中的重复列<br> select Student.Sno,Sname,Ssex,Sage,Sdept,Cno,Grade from Student [Inner] JOIN sc on Student.Sno=sc.Sno</p><p>例:查询计算机系的学生的修课情况,要求列出学生的名字,所选择课程号和成绩</p><pre><code>select Sname ,Cno ,Grade FROM Student JOIN sc ON Sudent .Sno =sc.Sno where Sdept ='计算机系'</code></pre><p><img src="/img/bV7o35" alt="clipboard.png"></p><p>可以为表提供别名,其格式如下:<br>from <源表名> [as] <表别名></p><p>为表指定别名可以简化表的书写,而且在有些连接查询中要求必须指定别名。</p><p>select Sname ,Cno,Grade From Student S join sc</p><p>这里要注意的是当你为表指定了别名在查询语句的其他地方,所有用到表民的地方都要使用别名,而不能在使用原表名。</p><p>例:查询信息系选修了计算机文化学课程的学生的信息,要求列出学生的姓名,课程名和成绩。</p><pre><code>select Sname ,Cname,Grade FROM Student s jOIN sc ON s.Sno=sc.Sno join course c ON c.Cno=SC.Cno where Sdept ='信息系' AND Cname='计算机文化学'</code></pre><p><img src="/img/bV7pa3" alt="clipboard.png"></p><p>查询所有选修了VB课程的学生情况,列出学生的姓名和所在的系。</p><pre><code>select Sname,Sdept From Student S JOIN sc ON S.Sno=sc.Sno JOIN course c ON c.Cno=sc.Cno where Sdept ='VB'</code></pre><p> <strong>注意:因为本来所需要的数据与sc表无关但是Student和Course没有可以进行连接的元素,所以这是需要引入sc表进行连接。</strong></p><p>2.自连接</p><p>自连接是一种特殊的内连接,相互连接的表在物理表上为同一张表,但在逻辑上将其看成两张表。<br><code>from 表1 T1</code>—在内存中生成表名为T1的表<br><code>join 表1 T2</code>—在内存中生成表名为T2的表<br>因此在自连接时一定要为表取别名。</p><p>查询与刘晨在一个系学习的所有学生的姓名和所在系<br> select S2.Sname ,S2.Sdept from Student S1 join Student S2 on S1.Sdept=S2.Sdept<br> where S1.Sname=’刘晨’ AND S2.Sname!=’刘晨’</p><p><img src="/img/bV7rYL" alt="clipboard.png"> —–><img src="/img/bV7rYS" alt="clipboard.png"></p><p>分析:<br><strong>先在s1中找出刘晨这一项数据然后在s2中找出除刘晨外的计算机系所有学生数据最后S1,S2查询结果通过计算机系进行连接</strong></p><p>3.外连接<br>有时候我们也希望看到那些不满足元组条件的元组信息,比如查看全部学生的选课的情况既想看到那些课程被选了,哪些课程没有被选择。因为内连接实现首先要有满足连接条件,sc.Cno=course.Cno,如果在sc表中没有人选择课程但是在course中却有,由于不满足上述条件所以查找不出来。</p><p><strong>外连接只限制一张表中的数据必须满足连接条件,而另一张表中的数据可以不满足连接条件。</strong><br> From 表1 left | right [outer] join 表2 ON <连接条件><br>如果是左外连接那么就是限制表2 中的数据必须满足连接条件,而不用管表1中的数据是否满足连接条件,均输出表一中的内容。右连接亦同。</p><p>例:查询学生的选课情况,包括选择了课程的学生和没有选择课程的学生,列出学号,姓名,课程号和成绩。</p><pre><code>左连接: select Student.Sno,Sname,Cno,Grade from Student left outer join sc on Student.Sno =sc.Sno右连接: select Student.Sno,Sname ,Cno,Grade From sc right outer join Student ON Student.Sno=SC.Sno</code></pre><p>例:查询哪些课程没有人选,列出其课程名。</p><pre><code>select Cname FROM Course C left join sc on c.cno=sc.cno where sc.cno is null.</code></pre><p>外连接操作中可以使用where 子句 ,group by子句等</p><p>查询计算机系没有选课的学生,列出学生的姓名和性别。</p><pre><code>select Sname,Sdept,Cno,grade from Student S left join sc on S.sno=sc.Snowhere Sdept ='计算机系' and Sc.Sno is null.</code></pre><p>假设我们让连接的两个表全部打印:<br><img src="/img/bV7vg3" alt="clipboard.png">——> <img src="/img/bV7vhs" alt="clipboard.png"><br>——-><img src="/img/bV7vkc" alt="clipboard.png"></p><pre><code>分析:首先进行外连接以student的sno进行连接从student里面拿一个学号与sc里面的学号进行比较相等则连接当student找不到时则连接空值行连接后的表再进行where筛选。注意此时还是要当成两个表去看待比如选择一个计算机系且没有选课的(Sno为null)的行就要写成:where Sdept ='计算机系'(sdept唯一只属于student的不用标识) and Sc.Sno(这个需要标识两者都有) is null.</code></pre><p>例:统计计算机系每个学生的选课门数,包括没有选课的学生,结果按选课门数递减排列。</p><pre><code>Select s.sno as 学号,count(sc.cno) as 选课门数 from student s left join sc on s.sno=sc.sno where sdept ='计算机系' group by s.sno order by count (sc.sno) desc</code></pre><p>首先通过sno进行连接<br><img src="/img/bV7vIv" alt="clipboard.png"><br>然后通过计算机系进行过滤<br><img src="/img/bV7vIz" alt="clipboard.png"><br>最后通过学号进行分组(需要指定因为学号不唯一)统计<br>并打印指定的参数列<br><img src="/img/bV7u7Q" alt="clipboard.png"></p><p><strong>16.</strong>使用TOP限制结果集<br>在使用select语句时我们希望只显示这些结果集中的前几行结果,就可以使用top语句。<br>格式:TOP n [percent] [with ties]<br>其中:</p><ul><li>n为非负数</li><li>TOP n:表示查询结果的前n%行的数据;</li><li>TOP n percent:表示取查询结果的前n%行 的数据;</li><li>WITH TIES:表示包括并列的结果。</li></ul><p>TOP谓词写在select单词的后边(如果有distinct的话,则在distinct 单词之后),查询列表的前边。</p>]]></content>
<summary type="html">
<p>数据查询功能:</p>
<pre><code>Select &lt;目标列名序列( 需要的列 )&gt; from &lt;数据源( 表格 )&gt;
[where&lt;检索条件表达式&gt;]
[Group by &lt;分组依据列&gt;]
[having &lt;组提取条件&gt;]
[order by &lt;排序依据列&gt;]
</code></pre>
</summary>
</entry>
<entry>
<title>Hello World</title>
<link href="https://why666.github.io/2018/12/15/hello-world/"/>
<id>https://why666.github.io/2018/12/15/hello-world/</id>
<published>2018-12-15T06:41:09.241Z</published>
<updated>2018-12-15T06:41:09.241Z</updated>
<content type="html"><![CDATA[<p>Welcome to <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="noopener">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="noopener">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="noopener">GitHub</a>.</p><a id="more"></a><h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">"My New Post"</span></span><br></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p><h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p><h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="noopener">Generating</a></p><h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="noopener">Deployment</a></p>]]></content>
<summary type="html">
<p>Welcome to <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="noopener">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="noopener">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="noopener">GitHub</a>.</p>
</summary>
</entry>
</feed>