mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-10-10 16:33:23 +08:00
sql语法高亮
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<div class="m-bg">
|
||||
<h1>SQL LAST() 函数</h1>
|
||||
<h2>LAST() 函数</h2> <p>LAST() 函数返回指定的列中最后一个记录的值。</p> <h3>SQL LAST() 语法</h3> <div class="code notranslate"><pre><div> SELECT LAST(column_name) FROM table_name;</div></pre></div> <p><b>注释:</b>只有 MS Access 支持 LAST() 函数。</p> <h2>SQL Server、MySQL 和 Oracle 中的 SQL LAST() 工作区</h2> <h3>SQL Server 语法</h3> <div class="code notranslate"><pre><div> SELECT TOP 1 <em>column_name</em> FROM <em>table_name<br/></em>ORDER BY<em> column_name </em>DESC;</div></pre></div> <h3>实例</h3> <div class="code notranslate"><pre><div> SELECT TOP 1 CustomerName FROM Customers<br/>ORDER BY CustomerID DESC;</div></pre></div> <h3>MySQL 语法</h3> <div class="code notranslate"><pre><div> SELECT <em>column_name</em> FROM <em>table_name</em><br/> ORDER BY <em>column_name</em> DESC<br/>LIMIT 1;</div></pre></div> <h3>实例</h3> <div class="code notranslate"><pre><div> SELECT CustomerName FROM Customers<br/>ORDER BY CustomerID DESC<br/>LIMIT 1;</div></pre></div> <h3>Oracle 语法</h3> <div class="code notranslate"><pre><div> SELECT <em>column_name </em>FROM <em>table_name</em><br/>ORDER BY <em> column_name </em>DESC<br/>WHERE ROWNUM <=1;</div></pre></div> <h3>实例</h3> <div class="code notranslate"><pre><div> SELECT CustomerName FROM Customers<br/>ORDER BY CustomerID DESC<br/>WHERE ROWNUM <=1;</div></pre></div> <h2>演示数据库</h2> <p>在本教程中,我们将使用众所周知的 Northwind 样本数据库。</p> <p>下面是选自 "Customers" 表的数据:</p> <table class="reference notranslate">
|
||||
<h2>LAST() 函数</h2> <p>LAST() 函数返回指定的列中最后一个记录的值。</p> <h3>SQL LAST() 语法</h3> <div class="code notranslate"><pre><code class="language-sql"><div> SELECT LAST(column_name) FROM table_name;</div></code></pre></div> <p><b>注释:</b>只有 MS Access 支持 LAST() 函数。</p> <h2>SQL Server、MySQL 和 Oracle 中的 SQL LAST() 工作区</h2> <h3>SQL Server 语法</h3> <div class="code notranslate"><pre><code class="language-sql"><div> SELECT TOP 1 <em>column_name</em> FROM <em>table_name<br/></em>ORDER BY<em> column_name </em>DESC;</div></code></pre></div> <h3>实例</h3> <div class="code notranslate"><pre><code class="language-sql"><div> SELECT TOP 1 CustomerName FROM Customers<br/>ORDER BY CustomerID DESC;</div></code></pre></div> <h3>MySQL 语法</h3> <div class="code notranslate"><pre><code class="language-sql"><div> SELECT <em>column_name</em> FROM <em>table_name</em><br/> ORDER BY <em>column_name</em> DESC<br/>LIMIT 1;</div></code></pre></div> <h3>实例</h3> <div class="code notranslate"><pre><code class="language-sql"><div> SELECT CustomerName FROM Customers<br/>ORDER BY CustomerID DESC<br/>LIMIT 1;</div></code></pre></div> <h3>Oracle 语法</h3> <div class="code notranslate"><pre><code class="language-sql"><div> SELECT <em>column_name </em>FROM <em>table_name</em><br/>ORDER BY <em> column_name </em>DESC<br/>WHERE ROWNUM <=1;</div></code></pre></div> <h3>实例</h3> <div class="code notranslate"><pre><code class="language-sql"><div> SELECT CustomerName FROM Customers<br/>ORDER BY CustomerID DESC<br/>WHERE ROWNUM <=1;</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 LAST() Example</h2> <p>下面的 SQL 语句选取 "Customers" 表的 "CustomerName" 列中最后一个记录的值:</p> <div class="example margin-b-10"> <h2 class="example">实例</h2> <pre><div class="example_code notranslate"> SELECT LAST(CustomerName) AS LastCustomer FROM Customers; </div></pre> </div> <div class="text-center padding-10 margin-t-5">
|
||||
<h2>SQL LAST() Example</h2> <p>下面的 SQL 语句选取 "Customers" 表的 "CustomerName" 列中最后一个记录的值:</p> <div class="example margin-b-10"> <h2 class="example">实例</h2> <pre><code class="language-sql"><div class="example_code notranslate"> SELECT LAST(CustomerName) AS LastCustomer FROM Customers; </div></code></pre> </div> <div class="text-center padding-10 margin-t-5">
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user