1: Can an SQL statement add, update, or delete two tables at the same time? 2: can a single SQL statement operate on multiple tables at the same time only select statements? 3: What if multiple new update/delete statements are separated by semicolons? 4: If multiple select statements are used with semicolons... 1: One SQL statement can be used to add, update, or delete two tables at the same time?
2: can a single SQL statement operate on multiple tables at the same time only select statements?
3: What if multiple add, update, or delete statements are separated by semicolons?
4: What if multiple select statements are separated by semicolons?
Reply content:
1: Can an SQL statement add, update, or delete two tables at the same time?
2: can a single SQL statement operate on multiple tables at the same time only select statements?
3: What if multiple add, update, or delete statements are separated by semicolons?
4: What if multiple select statements are separated by semicolons?
1: Can an SQL statement add, update, or delete two tables at the same time?
No. Of course, if you use;
Separating two SQL statements can be executed in the past .. But in a strict sense, it's not one.
2: can a single SQL statement operate on multiple tables at the same time only select statements?
Yes. Let's see what multi-Table operations you are referring to. If multiple tables have the same structure. UseUnion
Merge multiple table results. There are also subqueries, which are also called select multiple tables ..
3: What if multiple add, update, or delete statements are separated by semicolons?
Of course. It is equivalent to executing multiple statements .. However, some engines and frameworks will forcibly filter this type to prevent injection. Otherwise, someone inserts a semicolon in the middle of the query statement to execute any statements he wants to execute.
4: What if multiple select statements are separated by semicolons?
This is also based on the engine. Most of them will return the results of your request in sequence. Some Frameworks return the first and some return the last one. Based on the framework, we recommend that you directly write a simple SQL statement for testing ..
Ps. Generally, multiple SQL statements are not allowed at a time. Otherwise it would be really dangerous...
Only answer question 1.
Does the view count?
MySQL supports a "View", which can make multiple tables into one view. The addition, deletion, modification, and query operations on this view can affect multiple tables.
View description in MySQL 5.7: http://dev.mysql.com/doc/refman/5.7/en/views.html