Environment: MySQLSever5.1SQLServer2008R2 problem: the difference between MySQL and SQLServer in data insertion is shown in the following figure: MySQL: SQLServer: Create a table in MySQL and auto-increment the primary key. when inserting data, if the column name is not specified (indicating that each field is assigned), the column number does not match. The specified column name is inserted normally.
Environment: MySQL Sever 5.1 SQLServer 2008 R2 problem: the difference between MySQL and SQLServer in data insertion is shown in the following figure: MySQL: SQLServer: Create a table in MySQL and auto-increment the primary key, when you insert data, if you do not specify a column name (indicating that each field is assigned), the column number does not match. If you specify a column name, the data is inserted normally.
Environment: MySQL Sever 5.1 + SQLServer 2008 R2
Problem: The difference between MySQL and SQLServer in data insertion
Let's first look at two figures:
MySQL:
SQLServer:
Create a table in MySQL and the primary key is auto-incrementing. when data is inserted, the column name is not specified (indicating that each field is assigned a value). If the columns do not match, the specified column name is inserted normally; in SQLServer, the table's primary key is also auto-incrementing, but the column name can be inserted normally without being specified.
Appendix SQL:
MySQL
create table tb_user(id int primary key auto_increment,name varchar(20) not null,password varchar(16) not null);
SQLServer
create table tb_user(id int primary key identity,name varchar(20) not null,password varchar(20) not null);
Summary: when you use the command line to insert data, if you assign values to each field, you must specify the column name in MySQL instead of SQLServer. It can be seen that different databases support different SQL statements. Pay attention to these differences and summarize them. I would also like to remind you that using databases should not use graphical interfaces as much as possible. This will make you stupid and will not be helpful in understanding SQL. RecommendedCommand LineOperate the database.