当前位置:网站首页>MySQL statistical bill information (Part 2): data import and query

MySQL statistical bill information (Part 2): data import and query

2022-07-01 12:52:00 51CTO

Last one  mysql Statistics of billing information ( On ):mysql Installation and client DBeaver Connection to use It introduces mysql5.7 Installation and client DBeaver Connection configuration , This article continues with an article , Introduce data import and query Export .

One 、excel Import

The import of data can be excel It can also be a guide library , Let me introduce excel Import the way

1. turn csv

take xlsx Format conversion to csv Pattern

2. transcoding

Use notepad Open and transcode as UTF-8

mysql Statistics of billing information ( Next ): Data import and query _mysql

3. Guide table

mysql Statistics of billing information ( Next ): Data import and query _restore_02

take excel Import database

mysql Statistics of billing information ( Next ): Data import and query _mysql5.7_03

next step

mysql Statistics of billing information ( Next ): Data import and query _mysql5.7_04

Select mobile statement

mysql Statistics of billing information ( Next ): Data import and query _mysql_05

next step

mysql Statistics of billing information ( Next ): Data import and query _restore_06

mysql Statistics of billing information ( Next ): Data import and query _mysql_07

mysql Statistics of billing information ( Next ): Data import and query _mysql5.7_08

Report errors :

mysql Statistics of billing information ( Next ): Data import and query _mysql_09

The reason for this error is unauthorized , Authorization is enough

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON zd.* TO [email protected]’%’ identified by ‘root’;

     
  • 1.

4. Table view

mysql Statistics of billing information ( Next ): Data import and query _DBeaver_10

Table data viewing

mysql Statistics of billing information ( Next ): Data import and query _mysql5.7_11

Two 、 Recover database

This section demonstrates restore Import data in database mode

mysql Statistics of billing information ( Next ): Data import and query _restore_12

mysql Statistics of billing information ( Next ): Data import and query _mysql_13

mysql Statistics of billing information ( Next ): Data import and query _restore_14

Select the... To import sql file , Perform import , Authorization is required before importing

grant all privileges on `liuliangkafukuan`.* to 'loong576'@'%' identified by 'Loong576!'; 

     
  • 1.

Perform import

mysql Statistics of billing information ( Next ): Data import and query _DBeaver_15

The import process may involve max_allowed_packet Numerical adjustment , Set up max_allowed_packet Higher value

mysql> show global variables like 'max_allowed_packet'; 
mysql> set global max_allowed_packet=16777216;

     
  • 1.
  • 2.

mysql Statistics of billing information ( Next ): Data import and query _mysql5.7_16

mysql Statistics of billing information ( Next ): Data import and query _mysql5.7_17

Refresh the view

mysql Statistics of billing information ( Next ): Data import and query _DBeaver_18

see yd_csv Table structure :
mysql Statistics of billing information ( Next ): Data import and query _DBeaver_19

Move the full scale details :

mysql Statistics of billing information ( Next ): Data import and query _mysql5.7_20

3、 ... and 、 Move query statement

The query statement is based on restore Imported library table , It can also be imported excel, Here is an example of the former

1. Query statement

select  liuliangkafukuan.yd_csv. Card number ,liuliangkafukuan.yd_csv.ICCID,liuliangkafukuan.yd_csv.`1 month ` ,liuliangkafukuan.yd_csv.`2 month `,liuliangkafukuan.yd_csv.`3 month `,liuliangkafukuan.yd_csv.`4 month `,liuliangkafukuan.yd_csv.`5 month `,liuliangkafukuan.yd_csv.`6 month `,liuliangkafukuan.yd_csv.`7 month `,liuliangkafukuan.yd_csv.`8 month `,liuliangkafukuan.yd_csv.`9 month `,liuliangkafukuan.yd_csv.`10 month `,liuliangkafukuan.yd_csv.`11 month `,liuliangkafukuan.yd_csv.`12 month `,liuliangkafukuan. Move the full scale details . branch office  from liuliangkafukuan.yd_csv join liuliangkafukuan. Move the full scale details  on liuliangkafukuan. Move the full scale details . Card number  = liuliangkafukuan.yd_csv. Card number   and liuliangkafukuan. Move the full scale details .ICCID = liuliangkafukuan.yd_csv.ICCID ;

     
  • 1.

2. Query results

mysql Statistics of billing information ( Next ): Data import and query _mysql_21

3. Query result export

mysql Statistics of billing information ( Next ): Data import and query _mysql5.7_22

mysql Statistics of billing information ( Next ): Data import and query _mysql_23

mysql Statistics of billing information ( Next ): Data import and query _mysql5.7_24

mysql Statistics of billing information ( Next ): Data import and query _DBeaver_25

mysql Statistics of billing information ( Next ): Data import and query _mysql5.7_26

Select the output directory and file name format

mysql Statistics of billing information ( Next ): Data import and query _DBeaver_27

mysql Statistics of billing information ( Next ): Data import and query _mysql5.7_28

mysql Statistics of billing information ( Next ): Data import and query _mysql5.7_29

Export as follows :

mysql Statistics of billing information ( Next ): Data import and query _mysql5.7_30

原网站

版权声明
本文为[51CTO]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/182/202207011232346533.html