| Feature | MySQL | MSSQL |
|---|---|---|
| Ownership | Oracle Corporation | Microsoft |
| Licensing | Open-source (GPL) and commercial versions | Commercial with free Express Edition |
| Operating System Support | Windows, Linux, macOS, Unix | Primarily Windows, supports Linux (from 2017) |
| SQL Syntax | Standard SQL with MySQL-specific extensions | T-SQL (Transact-SQL) |
| Case Sensitivity | Case-insensitive on Windows, case-sensitive on Linux | Case-insensitive by default |
| Storage Engines | Supports multiple engines (InnoDB, MyISAM, etc.) | Unified storage model |
| Transactions & ACID Compliance | InnoDB engine provides ACID compliance | Full ACID compliance natively |
| Performance | Better for read-heavy workloads | Suitable for both read and write-heavy operations |
| Data Types | Limited data types (JSON supported in later versions) | Wider range (includes JSON, XML, spatial data types) |
| Backup & Recovery | Backup through database dumps, slower recovery | Advanced options, point-in-time recovery |
| Replication & Clustering | Master-slave and master-master replication | Always On Availability Groups, clustering, replication |
| Community & Support | Large open-source community | Enterprise support from Microsoft |
| Cost | Free (open-source) with commercial options | Paid, with free Express Edition |
| Integration | Moderate integration with Microsoft products | Seamless integration with Microsoft ecosystem |
LIMIT Clause: The LIMIT clause is used to specify the number of records to return.
SELECT * FROM Customers
LIMIT 3;
--The SQL query below says "return only 3 records, start on record 4 (OFFSET 3)":
SELECT * FROM Customers LIMIT 3 OFFSET 3;
--Same work in MSSQL:
SELECT * FROM Customers Order by 1
OFFSET 3 ROWS
FETCH NEXT 3 ROW ONLY;
Store Procedure:
# Temp changing delimiter $$
DELIMITER $$
CREATE PROCEDURE `GetCountry`(IN region varchar(50))
BEGIN
Select * from country where country.region = region;
END$$
# Again changing delimiter
DELIMITER ;