mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-10-11 00:43:20 +08:00
sql语法高亮
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<div class="m-bg">
|
||||
<h1>SQL LIKE 操作符</h1>
|
||||
<p class="intro">LIKE 操作符用于在 WHERE 子句中搜索列中的指定模式。</p> <h2>SQL LIKE 操作符</h2> <p>LIKE 操作符用于在 WHERE 子句中搜索列中的指定模式。</p> <h3>SQL LIKE 语法</h3> <div class="code notranslate"><pre><div> SELECT <em>column_name(s)</em><br/> FROM <em>table_name</em><br/> WHERE <em>column_name</em> LIKE <em>pattern</em>;</div></pre></div> <h2>演示数据库</h2> <p>在本教程中,我们将使用众所周知的 Northwind 样本数据库。</p> <p>下面是选自 "Customers" 表的数据:</p> <table class="reference notranslate">
|
||||
<p class="intro">LIKE 操作符用于在 WHERE 子句中搜索列中的指定模式。</p> <h2>SQL LIKE 操作符</h2> <p>LIKE 操作符用于在 WHERE 子句中搜索列中的指定模式。</p> <h3>SQL LIKE 语法</h3> <div class="code notranslate"><pre><code class="language-sql"><div> SELECT <em>column_name(s)</em><br/> FROM <em>table_name</em><br/> WHERE <em>column_name</em> LIKE <em>pattern</em>;</div></code></pre></div> <h2>演示数据库</h2> <p>在本教程中,我们将使用众所周知的 Northwind 样本数据库。</p> <p>下面是选自 "Customers" 表的数据:</p> <table class="reference notranslate">
|
||||
<tr>
|
||||
<th>CustomerID</th> <th>CustomerName</th> <th>ContactName</th> <th>Address</th> <th>City</th> <th>PostalCode</th> <th>Country</th> </tr>
|
||||
<tr>
|
||||
@@ -16,6 +16,6 @@
|
||||
<tr>
|
||||
<td>5</td> <td>Berglunds snabbköp</td> <td>Christina Berglund</td> <td>Berguvsvägen 8</td> <td>Luleå</td> <td>S-958 22</td> <td>Sweden</td> </tr>
|
||||
</table>
|
||||
<h2>SQL LIKE 操作符实例</h2> <p>下面的 SQL 语句选取 City 以字母 "s" 开始的所有客户:</p> <div class="example margin-b-10"> <h2 class="example">实例</h2> <pre><div class="example_code notranslate"> SELECT * FROM Customers<br/> WHERE City LIKE 's%'; </div></pre> </div> <p><strong>提示:</strong>"%" 符号用于在模式的前后定义通配符(缺省字母)。您将在下一章中学习更多有关通配符的知识。</p> <p>下面的 SQL 语句选取 City 以字母 "s" 结尾的所有客户:</p> <div class="example margin-b-10"> <h2 class="example">实例</h2> <pre><div class="example_code notranslate"> SELECT * FROM Customers<br/> WHERE City LIKE '%s'; </div></pre> </div> <p>下面的 SQL 语句选取 Country 包含模式 "land" 的所有客户:</p> <div class="example margin-b-10"> <h2 class="example">实例</h2> <pre><div class="example_code notranslate"> SELECT * FROM Customers<br/> WHERE Country LIKE '%land%'; </div></pre> </div> <p>通过使用 NOT 关键字,您可以选取不匹配模式的记录。</p> <p>下面的 SQL 语句选取 Country 不包含模式 "land" 的所有客户:</p> <div class="example margin-b-10"> <h2 class="example">实例</h2> <pre><div class="example_code notranslate"> SELECT * FROM Customers<br/> WHERE Country NOT LIKE '%land%'; </div></pre> </div> <div class="text-center padding-10 margin-t-5">
|
||||
<h2>SQL LIKE 操作符实例</h2> <p>下面的 SQL 语句选取 City 以字母 "s" 开始的所有客户:</p> <div class="example margin-b-10"> <h2 class="example">实例</h2> <pre><code class="language-sql"><div class="example_code notranslate"> SELECT * FROM Customers<br/> WHERE City LIKE 's%'; </div></code></pre> </div> <p><strong>提示:</strong>"%" 符号用于在模式的前后定义通配符(缺省字母)。您将在下一章中学习更多有关通配符的知识。</p> <p>下面的 SQL 语句选取 City 以字母 "s" 结尾的所有客户:</p> <div class="example margin-b-10"> <h2 class="example">实例</h2> <pre><code class="language-sql"><div class="example_code notranslate"> SELECT * FROM Customers<br/> WHERE City LIKE '%s'; </div></code></pre> </div> <p>下面的 SQL 语句选取 Country 包含模式 "land" 的所有客户:</p> <div class="example margin-b-10"> <h2 class="example">实例</h2> <pre><code class="language-sql"><div class="example_code notranslate"> SELECT * FROM Customers<br/> WHERE Country LIKE '%land%'; </div></code></pre> </div> <p>通过使用 NOT 关键字,您可以选取不匹配模式的记录。</p> <p>下面的 SQL 语句选取 Country 不包含模式 "land" 的所有客户:</p> <div class="example margin-b-10"> <h2 class="example">实例</h2> <pre><code class="language-sql"><div class="example_code notranslate"> SELECT * FROM Customers<br/> WHERE Country NOT LIKE '%land%'; </div></code></pre> </div> <div class="text-center padding-10 margin-t-5">
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user