Import data from execl into Sqlite3

Source: Internet
Author: User
Tags save file

To get the CVS file: Select the Execl File menu, select the Save As option, the Save File dialog box appears, select the text CVS (. cvs) file type in the Save file type,

Tick the Edit Filter settings option, press the Save button, a dialog box will appear, which can set the format of the saved file.

Font selection (Unicode, Weatern Europe, etc.), the region separator can be selected ', ' (comma) can also choose '; ' (semicolon), provided that

Execl source file does not contain the symbol, the other options to choose the format you want, and then click ' OK ' to save, you can get a suffix

The CVS file, which belongs to a text file, can be opened with a text editor (Txteditor).

Import the CVS file into the Sqlite3 database:

The contents of the CVS file are as follows:

Yield, produce
Yoke, Yoke
Yonder, over there.
You, you.
Young, Younger.
Youngster, teenager
Your, your
yourself, your own
Youth, Young
Youthful, young.
Zeal, enthusiastic
Zealous, enthusiastic.
Zero, 0
Zest, enthusiastic
Zinc, Zinc
Zone, Zone
Zoo, zoos
Zoological, zoology.
Zoology, Zoology

Enter the Sqlite3 database, and at the command line:

Sqlite3 dict.db

Dict.db is a database, if the database does not exist, it will be created, if the database already exists, it will enter the database

First, create a table in Sqlite3 that will be formatted to match the contents of the CVS file (primarily the number of columns), with the following command:

CREATE TABLE Word (word varchar), desc varchar (100));

Next you import the CVS into the table word, you need to first set the delimiter to ', ' (comma), enter the command as follows:

. Separator ', '

Then enter the command:

. Import *.cvs Word

You can import the contents of CVS into a table in Word.

Note: There is a small dot before separator and import, which is where SQLite differs from SQL,

There are no semicolons at the end of two statements, *. CVS is the file name for CVS, and Word is the table name.

To see if the import was successful, enter the command:

SELECT * from Word;

Results:

yield| generation
yoke| Yoke
Yonder| over there.
You| you, you
Young| Young
youngster| teenager
Your| you.
Yourself| your own
youth| Youth
youthful| Young.
zeal| enthusiastic
zealous| warm-hearted
zero| 0
Zest| enthusiastic
zinc| Zinc
zone| Zone
Zoo| Zoo
Zoological| of Zoology
zoology| Zoology

Data import succeeded.

It is sometimes a time-saving approach to import large amounts of data into a database.


Import data from execl into Sqlite3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.