Patchwork of SQL statements using Excel

   The combined fast over one row of data into a single cell
   
       EXCEL how quickly merge more than one row of data into a cell, and add a separator? This is a common statistical method when batch processing of sales data from the line, especially when the data is a condition where the id. A simple, quick way to demonstrate to you the following.
      It assumed that the data have been stored in the A column. Open Excel, and then follow the following three steps
  •  Input cell B1 = A1: A6;
  •  Press F9, and then delete the equal sign in front of the braces {};
  •  Where necessary, the cell is "replaced with a null.
    See attached.

    FIG 1 A column initialized, and enter the formula in cell B1

 

     FIG 2 is converted to the desired text formula

    At this point, we can quickly get in B1, A1 to A6 cell data, delimiters discretion, I believe not beat you smart.
 
Use CONCATENATE function patchwork SQL
 
       During the development process, often encounter need statistical data to Excel inside to initialize the database inside, how to do? It is recommended to use the CONCATENATE function in Excel. Usage in Excel CONCATENATE function is to connect a plurality of data characters in the text or in a cell together, in a display cell; Up to 255 text strings into a text string.
 
grammar
  CONCATENATE (text1,text2,...)
  text1, text2, ... of 1-255 to be merged into a single text item text items, items must be separated by commas and items. These items can be text, numbers, or reference to a single cell of a text string.
 
      In cell D1 input [INSERT INTO `user` (` id`, `name`) VALUES ( '], [in the input E1' ''], the input [F1 ');]. Enter the formula in C1
=CONCATENATE($D$1,$A1,$E$1,$B1,$F$1)

Then, the bottom right handle drag cell 6 to generate SQL.

 

      The first statement is a [INSERT INTO `user` (` id`, `name`) VALUES ( '1', 'name1');], the other is omitted.

      Of course, this is just a simple example, the actual development process, data base complex than this, we can Zhaomaohuahu.

 
 

Guess you like

Origin www.cnblogs.com/east7/p/11104831.html