SQL database import, export, copy table, rename table

Foreword

Description This is a white advance summary, please do not spray master bypass, write the reason this summary is sometimes found myself really attracted me, and Road to SR, spent a lot of time to see the index, cache, and so on from master , until the emergence of practical problems but found himself lounged actually have to write SQL statements syntax error, seems to have to start from the slow and steady basis, because SQL is not much used in practice, and now to a few commonly used To sum up, even if not immediately write the next, can quickly find the desired in this article.

As mentioned in the title, in the import and export processing emergency very common data line database, and also to substantially replicate table does not affect the troubleshooting case where the original data, rename large tables for Java the original data is not overwritten when introducing multiple copies of the backup data, such as like Comparative a table data for two days, can put a large Java data into data of the first day, and then to modify the table AOLD a, followed by a second direct re-introduced days of database data, database tables so that you can compare the Aold and a, write very long when compared to avoid two SQL databases in the same table.

test environment

Welcome to the monitor. Commands end with ; or \g.
Your python connection id is 11
Server version: 5.7.28-log Community Server (GPL)
Copyright © 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

Testing process

To illustrate specific SQL implementation of these requirements, we first create a test database, and then create the test table, insert test data, and finally turn to achieve these requirements in this database.

Create test data

Create a test database and tables

推荐系统
sql> create database dbtest;
Query OK, 1 row affected (0.00 sec)

sql> use Python
Database changed

sql> create table a(id int, num int);
Query OK, 0 rows affected (0.02 sec)

sql> create table b(id int, name varchar(32));
Query OK, 0 rows affected (0.01 sec)

sql> show tables;
+--------------+
| Tables_in_zz |
+--------------+
| a            |
| b            |
+--------------+
2 rows in set (0.00 sec)

Insert test data

sql> insert into a values(1, 100);
Query OK, 1 row affected (0.02 sec)

sql> insert into a values(2, 200);
Query OK, 1 row affected (0.01 sec)

sql> select * from a;
+------+------+
| id   | num  |
+------+------+
|    1 |  100 |
|    2 |  200 |
+------+------+
2 rows in set (0.01 sec)

sql> insert into b values(1, 'albert');
Query OK, 1 row affected (0.01 sec)

sql> insert into b values(2, 'tom');
Query OK, 1 row affected (0.01 sec)

sql> select * from b;
+------+--------+
| id   | name   |
+------+--------+
|    1 | albert |
|    2 | tom    |
+------+--------+
2 rows in set (0.00 sec)

image

Here Insert Picture Description

video

1080P [stage] the whole network the most complete (seems to be) -20191204 MAMA SEVENTEEN cut

Follow the principle of preemptive mode

Recommended system priority principle. Android meant allowing a higher priority process preempt the current process of New processor, that is, when there is a new process arrives, if it has higher priority than the priority is the implementation process, the scheduler will run deprive the current process, the New processor allocated to high priority process.
Short process priority principle, referring to short to allow newly arrived process can preempt the current processor of a long process, that is, when the newly arrived process is shorter than the process (remaining runtime) is being executed, the scheduler will run deprive the current process, the processor is assigned to a high priority of the newly arrived process.
Time slice principle. That is, each process cycle run time slice, the time slice when a process is being executed after use, stops execution of the process of re-scheduling.

to sum up

Save site information processor. First need to save the current scheduling process during the site information processor, such as the program counter, the contents of the plurality of general purpose registers.
Select by some process. Scheduler according to some select from a ready queue process, its status changed to running and ready processors allocated to him.
Assign processor to process. Assigned by the dispatcher processor to the process, this time need to process respective ones of the registers within the process control block relating to the selected site the information loaded into the processor in the processor, the processor is given to the control of the process, so that his resume from the last breakpoint.
Enterprise data needs are constantly changing, the change in recent years the trend has become increasingly evident, from 3V to see the nature of the data: volume, velocity and change; Big Data emphasis on the amount of data, PB level and above, is static data. The Fast Data on the basis of the amount of data, and means that the speed and change, means that customers can be more real-time, data processing faster.
In a recent study, more than 75 percent of respondents have used Fast Data solutions. In those surveyed, 88% said they need to perform near real time analysis of the data.
AnalyticDB Alibaba independent research and development, as well as the only core business through large scale validation of PB grade real-time data warehouse, is the best representative of FastData. Since 2012, first published on-line in the group, has released a total of nearly one hundred iterative version, support from within the PBX, advertising, rookie, entertainment, Flying Pig and many other online business analysis. AnalyticDB in 2014 in Ali cloud officially start output, support industry includes both traditional medium and large enterprises and government agencies, as well as many Internet companies, covering more than a dozen outside the industry.
AnalyticDB undertake the Alibaba advertising and marketing, high concurrency processing business data analysis services, logistics rookie, horse boxes and many new retail core business, the annual two-eleven peak above the many real-time analysis of business driven architecture AnalyticDB constant evolution and technological innovation.
Demand for Fast Data processing milliseconds, redesigned architecture to provide timely and cost-effective systems and methods for data processing, each event is processed on arrival, processing delay to seconds, milliseconds, and truly meet the data volume, speed and changes 3V properties, help enterprises to create a real-world semantic data segmented image.

Issued 10,000 + original articles · won praise 109 · views 370 000 +

Guess you like

Origin blog.csdn.net/cpongo4/article/details/103424733