End of-----------------------------------translation--------------------------------
Above I marked the "1th timestamp column" With a red font, because a table with multiple timestamp columns is defined differently.
For example, the second article above: "If you do not use the default or ON UPDATE clause, it is equivalent to the default current_tim
format for defining foreign keys is as follows:
Foreign key [table name 1] (column name 1) REFERENCES table name 2 (column name 2) [on update [CASCADE] | [set null] | [RESTRICT] [on delete [CASCADE] | [set null] | [RESTRICT]The on update and on delete operations between the master and slave tables indicate the main operation methods used to modify and DELETE the data in the table.
CASCADE: CASCADE deleti
-increment), these fields can be omitted from either of these methods. The above two statements can be written in the following form, such as using the self-increment on the ID field:
INSERT into the users (name, age) VALUES (' Yao Ming ');
INSERT into uses SET name = ' Yao Ming ', age = 25;
MySQL has also made some changes in values. If nothing is written in values, MySQL inserts the new recor
primary key index, and if a statement operates a non-primary key index, MySQL locks the non-primary key index and then locks the primary key index.Problem phenomenon:Error log on the line: MySQL deadlock problem.Troubleshooting process:Ask the DBA to help you check the MySQL error log and discover that there is a deadlock problem.The deadlock is the above two SQ
column. 1. Mysql> SELECT last_insert_id (); 2.195 generationID is saved in the server after each connection. This means that the value returned by the function to a given client is the first Auto_increment value that the client produces to the most recent statement affecting the Auto_increment column .。 This value cannot be affected by other clients, that is, they produce their own auto_increment values. This behavior ensures that you can retrieve yo
MySQL Insert/Update dataINSERT Statement1. List the values of all fields at once, for example:INSERT INTO student VALUES ('chenqi','M', $); INSERT INTO Student VALUES ('Bush',' m', ', '), (' Obama'm ', 45);Allows multiple rows of data to be inserted simultaneously;2. Assign values only to partial fieldsINSERT into student (name, sex) VALUES ('Abby'F'), (' Joseph
This article, "My MySQL Learning Experience (eight)" will explain MySQL insert, UPDATE, and DELETE statementsSimilarly, it will only explain the different parts of SQL Server.InsertInserting multiple rows of query results into a tableGrammarINSERT into Table_name1 (column_list1) SELECT (column_list2) from table_name2 W
Comparison with MSSQL to learn about MYSQL (8) -- insert, update, delete, and mssqlmysql
Similarly, it will only explain the difference between SQL Server and SQL Server.
Insert
Insert multi-row query results into the table
Syntax
INSERT INTO table_name1(column_list1) SELECT (column_list2) FROM table_name2 WHERE (condition)
Insert into select is also supported in SQLSERVER
Table_name1 specifies the table to
especially useful for multi-row insertions. The VALUES () function is only in the INSERT ... The UPDATE statement makes sense, and returns NULLat other times. Example: INSERT into table (a,b,c) VALUES (4,5,6) On DUPLICATE KEY UPDATE c=values (a) +values (b); This statement works the same as the following two statements: INSERT into table (a,b,c) VALUES (4,5,6) on DUPLICATE KEY
Mysql creates a stored procedure and uses Cursor to cyclically update bitsCN.com
Use cursor)
1. declare a cursor
DECLARECursor_nameCursor for select_statementThis statement declares a cursor. You can also define multiple cursors in a subroutine, but each cursor in a block must have a unique name. A single operation is performed after the cursor is declared, but t
Mysql supports cross-table delete multi-table record bitsCN.com a few days ago, I wrote a summary of Mysql cross-table update. today we will look at cross-table deletion.
After Mysql4.0, mysql began to support cross-table delete.
Mysql can delete
statements are called! However, using this method increases the load on the server, because every SQL Server executes the same SQL analysis and optimization operations. Fortunately, MySQL provides another solution, that is, using an INSERT statement to INSERT multiple records. This is not a standard SQL syntax, so it can only be used in MySQL.
Insert into users
Mysql cross-table update multi-table updatesql statement summary bitsCN.com suppose we have two tables, one table stores Product information for the Product table, with the Product Price column Price, and the other table is the ProductPrice table, update the Price field in the ProductPrice table to 80% of the Price field in the Price table.
In
these methods. The above two statements can be written in the form of INSERT into user (name, age) VALUES (' Yao Ming ',), if the self-increment is used on the ID field; INSERT into uses SET name = ' Yao Ming ', age = 25; MySQL has also made some changes in values. If nothing is written in values, MySQL inserts the new record using the default values for each column in the table. INSERT into Users () V
MySQL Updates Data UPDATE statement
Definition of the UPDATE statement:
The update syntax can update columns in existing table rows with new values. Let's take a look at the definition of the
Tags: SQLMySQL Database Basics (vi)--SQL INSERT, UPDATE, delete operation one, insert data 1, insert data for all fields of the tableInserting data using a basic INSERT statement requires specifying the table name and the values inserted into the new record.INSERT INTO table_name (column_list) VALUES (value_list);insert into `TSubject` (subjectID,subjectName,BookName,Publisher)values (‘0004‘,‘英语‘,‘大学英语走遍美国‘,‘清华出版社‘)可以不指定插入的列insert into `TSubject` valu
Tags: desc mysql body Problem blog configuration Warnings Statement comTo create an index on a table's fieldsIndexes are like catalogs of books, and if indexed on a field, you can speed up querying data when indexed. 1 Creating a primary key indexQuerying the contents of the database, the primary key query is the fastest, each table can have only one primary key, but there are multiple ordinary index
In some cases, you may want to run multiple servers on the same machine. For example, you may want to test a new MySQL version so that the settings of your existing production system are not disturbed, or you may want to install an Internet service provider for an independent MySQL instance for different customers. If you want to run
Scenario: update the value of all fields that meet the condition according to the message code and status. The value is quot; T quot ;. How to batch update? If it is a single condition, use the iterate label to put the value in ( #39; xxx #39;, #39; yyy #39;) for a loop, how does mysql handle multiple conditions a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.