
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
MySQL LIMIT clause equivalent for SQL SERVER?
Firstly, we need to create a table to understand the limit clause (as we want for SQL server).We will create a table with the help of CREATE command.
Creating a table
mysql> CREATE table limitDemo -> ( -> id int, -> primary key(id) -> ); Query OK, 0 rows affected (0.58 sec)
After that, let us insert records into the table −
mysql> INSERT into limitDemo values(1); Query OK, 1 row affected (0.16 sec) mysql> INSERT into limitDemo values(2); Query OK, 1 row affected (0.12 sec) mysql> INSERT into limitDemo values(3); Query OK, 1 row affected (0.11 sec) mysql> INSERT into limitDemo values(4); Query OK, 1 row affected (0.10 sec) mysql> INSERT into limitDemo values(5); Query OK, 1 row affected (0.12 sec) mysql> INSERT into limitDemo values(6); Query OK, 1 row affected (0.13 sec) mysql> INSERT into limitDemo values(7); Query OK, 1 row affected (0.15 sec) mysql> INSERT into limitDemo values(8); Query OK, 1 row affected (0.09 sec) mysql> INSERT into limitDemo values(9); Query OK, 1 row affected (0.14 sec)
Displaying all the records with the help of SELECT statement −
mysql> SELECT * from limitDemo;
The following is the output
+----+ | id | +----+ | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | | 9 | +----+ 9 rows in set (0.00 sec)
Let us see the query of limit clause and begin with the syntax −
SELECT column_name1……..N from yourTableName limit integervalue offset integervalue;
Now, I am applying the above query −
mysql> SELECT id from limitDemo limit 5 offset 2;
The following is the output
+----+ | id | +----+ | 3 | | 4 | | 5 | | 6 | | 7 | +----+ 5 rows in set (0.00 sec)
- Related Articles
- Equivalent of SQL Server IDENTITY Column in MySQL?
- How to write a MySQL “LIMIT” in SQL Server?
- The equivalent of SQL Server function SCOPE_IDENTITY() in MySQL?
- Does SQL Server have an equivalent to MySQL's ENUM data type?
- What is the C# Equivalent of SQL Server DataTypes?
- Difference between MySQL and SQL Server
- How Can we use MySQL DISTINCT clause with WHERE and LIMIT clause?
- Database Wars: MSSQL Server, Oracle PL/SQL and MySQL
- How to simulate the LIMIT MySQL clause with an Access database?
- Is there a Microsoft equivalent for HTML5 Server-Sent Events?
- Generate table DDL via a query on MySQL and SQL Server?
- ROW_NUMBER() equivalent in MySQL for inserting?
- SQL Query to Convert Rows to Columns in SQL Server
- Mean and Mode in SQL Server
- Difference between Oracle and SQL Server

Advertisements