当前位置:网站首页>Building SQL statements in Excel

Building SQL statements in Excel

2022-06-29 15:23:00 Game programming

1、 background

In production , We are often faced with importing Excel Data to database requirements , Before writing the importer , In the case of importing database client tools . We can go through Excel Its own formula constructs sql sentence , Can be copied to run .

  • Prepare the material Excel The table is as follows :
    Excel Build SQL sentence - The first 1 Zhang

  • Database table information to be imported :

    Excel Build SQL sentence - The first 2 Zhang

2、 Implementation process

2.1 Use CONCATENATE Function batch splicing "insert" sentence .
  • stay F Enter the following formula in the field :
=CONCATENATE("insert into register_shop_info (shop_code,shop_name,shop_id,company_id) values ('",C1,"','",B1,"','",D1,"','",A1,"');")

Excel Build SQL sentence - The first 6 Zhang
  • Press and drag the right subscript
    Excel Build SQL sentence - The first 3 Zhang

  • Copy out sql sentence , And execute... In the database .

    Excel Build SQL sentence - The first 4 Zhang

  • Data presentation

    Excel Build SQL sentence - The first 5 Zhang

Reference resources :https://blog.csdn.net/vince6799/article/details/2564931
author :Geroge1226

Game programming , A game development favorite ~

If the picture is not displayed for a long time , Please use Chrome Kernel browser .

原网站

版权声明
本文为[Game programming]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/180/202206291502163681.html