search
HomeDatabaseMysql TutorialMySQL与SQL Server的一些区别浅析_MySQL

1、mysql支持enum,和set类型,sql server不支持
2、mysql不支持nchar,nvarchar,ntext类型
3、mysql的递增语句是AUTO_INCREMENT,而mssql是identity(1,1)
4、mssql默认到处表创建语句的默认值表示是((0)),而在mysql里面是不允许带两括号的
5、mysql需要为表指定存储类型
6、mssql识别符是[],[type]表示他区别于关键字,但是mysql却是 `,也就是按键1左边的那个符号
7、mssql支持getdate()方法获取当前时间日期,但是mysql里面可以分日期类型和时间类型,获取当前日期是cur_date(),当前完整时间是 now()函数
8、mssql不支持replace into 语句,但是在最新的sql20008里面,也支持merge语法
9、mysql支持insert into table1 set t1 = ‘', t2 = ‘' ,但是mssql不支持这样写
10、mysql支持insert into tabl1 values (1,1), (1,1), (1,1), (1,1), (1,1), (1,1), (1,1)
11 mssql不支持limit语句,是非常遗憾的,只能用top 取代limt 0,N,row_number() over()函数取代limit N,M
12、mysql在创建表时要为每个表指定一个存储引擎类型,而mssql只支持一种存储引擎
13、mysql不支持默认值为当前时间的datetime类型(mssql很容易做到),在mysql里面是用timestamp类型
14、mssql里面检查是否有这个表再删除,需要这样:if exists (select * from dbo.sysobjects where id=id (N'uc_newpm') and  OBJECTPROPERTY(id, N'IsUserTable') = 1) 但是在mysql里面只需要 DROP TABLE IF EXISTS cdb_forums;
15、mysql支持无符号型的整数,那么比不支持无符号型的mssql就能多出一倍的最大数存储
16、mysql不支持在mssql里面使用非常方便的varchar(max)类型,这个类型在mssql里面既可做一般数据存储,也可以做blob数据存储
17、mysql创建非聚集索引只需要在创建表的时候指定为key就行,比如:KEY displayorder (fid,displayorder) 在mssql里面必须要:

代码如下:

create unique nonclustered index index_uc_protectedmembers_username_appid on dbo.uc_protectedmembers (username asc,appid asc)


18、mysql text字段类型不允许有默认值
19、mysql的一个表的总共字段长度不超过65XXX。
20、一个很表面的区别就是mysql的安装特别简单,而且文件大小才23M左右(5.5.23),相比微软这个庞然大物,安装进度来说简直就是.....
21、mysql的管理工具有几个比较好的,mysql_front,和官方那个套件,不过都没有SSMS的使用方便,这是mysql很大的一个缺点。
22、mysql的存储过程只是出现在最新的版本中,稳定性和性能可能不如mssql。
23、同样的负载压力,mysql要消耗更少的CPU和内存,mssql的确是很耗资源。
24、php连接mysql和mssql的方式都差不多,只需要将函数的mysql替换成mssql即可,如果是PDO方式只需要把mysql替换mssql即可。
25、mysql支持date,time,year类型,mssql到2008才支持date和time。

附:MySQL与MSSQL分页的区别

之前一直用MySQL,虽然比起mssql这个庞大的数据库系统mysql很苗条,但它并不逊色。以下说说这两个在数据库各自的分页区别
例1,取出前十条

代码如下:


SELECT * FROM table LIMIT 10;


在mssql中

代码如下:


SELECT TOP 10 * FROM table


例2,每页十条,取出第三页
在MySQL中

代码如下:


SELECT * FROM table LIMIT 20,10


在mssql中

代码如下:


SELECT TOP 10 * FROM table WHERE id NOT IN(
        SELECT TOP 20 id FROM table ORDER BY id DESC
) ORDER BY id DESC;


由以上例子可以看出,在MySQL中分页用LIMIT关键字,如果是LIMIT 10表示取前十条,如果是LIMIT 10,10表示偏移十条取前十条记录。在mssql中用top关键字,如果只取前n条记录直接top n即可,但是要是分页取就有点麻烦。
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
When should you use a composite index versus multiple single-column indexes?When should you use a composite index versus multiple single-column indexes?Apr 11, 2025 am 12:06 AM

In database optimization, indexing strategies should be selected according to query requirements: 1. When the query involves multiple columns and the order of conditions is fixed, use composite indexes; 2. When the query involves multiple columns but the order of conditions is not fixed, use multiple single-column indexes. Composite indexes are suitable for optimizing multi-column queries, while single-column indexes are suitable for single-column queries.

How to identify and optimize slow queries in MySQL? (slow query log, performance_schema)How to identify and optimize slow queries in MySQL? (slow query log, performance_schema)Apr 10, 2025 am 09:36 AM

To optimize MySQL slow query, slowquerylog and performance_schema need to be used: 1. Enable slowquerylog and set thresholds to record slow query; 2. Use performance_schema to analyze query execution details, find out performance bottlenecks and optimize.

MySQL and SQL: Essential Skills for DevelopersMySQL and SQL: Essential Skills for DevelopersApr 10, 2025 am 09:30 AM

MySQL and SQL are essential skills for developers. 1.MySQL is an open source relational database management system, and SQL is the standard language used to manage and operate databases. 2.MySQL supports multiple storage engines through efficient data storage and retrieval functions, and SQL completes complex data operations through simple statements. 3. Examples of usage include basic queries and advanced queries, such as filtering and sorting by condition. 4. Common errors include syntax errors and performance issues, which can be optimized by checking SQL statements and using EXPLAIN commands. 5. Performance optimization techniques include using indexes, avoiding full table scanning, optimizing JOIN operations and improving code readability.

Describe MySQL asynchronous master-slave replication process.Describe MySQL asynchronous master-slave replication process.Apr 10, 2025 am 09:30 AM

MySQL asynchronous master-slave replication enables data synchronization through binlog, improving read performance and high availability. 1) The master server record changes to binlog; 2) The slave server reads binlog through I/O threads; 3) The server SQL thread applies binlog to synchronize data.

MySQL: Simple Concepts for Easy LearningMySQL: Simple Concepts for Easy LearningApr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

MySQL: A User-Friendly Introduction to DatabasesMySQL: A User-Friendly Introduction to DatabasesApr 10, 2025 am 09:27 AM

The installation and basic operations of MySQL include: 1. Download and install MySQL, set the root user password; 2. Use SQL commands to create databases and tables, such as CREATEDATABASE and CREATETABLE; 3. Execute CRUD operations, use INSERT, SELECT, UPDATE, DELETE commands; 4. Create indexes and stored procedures to optimize performance and implement complex logic. With these steps, you can build and manage MySQL databases from scratch.

How does the InnoDB Buffer Pool work and why is it crucial for performance?How does the InnoDB Buffer Pool work and why is it crucial for performance?Apr 09, 2025 am 12:12 AM

InnoDBBufferPool improves the performance of MySQL databases by loading data and index pages into memory. 1) The data page is loaded into the BufferPool to reduce disk I/O. 2) Dirty pages are marked and refreshed to disk regularly. 3) LRU algorithm management data page elimination. 4) The read-out mechanism loads the possible data pages in advance.

MySQL: The Ease of Data Management for BeginnersMySQL: The Ease of Data Management for BeginnersApr 09, 2025 am 12:07 AM

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.