SQLite Database Preliminary

Source: Internet
Author: User
Tags sqlite sqlite database

Windows 10 Home Chinese version

I want to use Python to manipulate the SQLite database, but I don't know how to create a database file.

I took a stroll around the SQLite website and finally installed the database files I needed using the tools above.

1. Enter the official website: show the latest version of SQLite is 3.23.1, click the Download button to enter the download page;

2. Download page: Find a package for Windows, download sqlite-tools-*, that is, a third, there are tools to create SQLite database files;

3. After the download: Unzip the folder inside there are three EXE files, wherein, Sqlite3.exe is used to create SQLite database files;

4. Double-click Sqlite3.exe, open a command-line tool, and enter ". Help" (Point helps) for information;

You can find more usage information in the Official SQLite command line Shell for SQLite page (which is located in the description of the previous download file), much more than I have said in this article.

5. Create a new database file

Sqlite>. Open--new test.db

The above command creates the database file test.db in the same directory as the Sqlite3.exe command (you can toggle the current path using the ". cd file directory").

After new, you can use legitimate SQL statements to do things like create a table, insert a record, delete a record ... Yes, the database was not created because SQLite

The database file is a database.

Opening an existing database also uses the. Open command, but the--new option is not required at this time.

It is important to note that the use of--new may result in an existing database being emptied or an error has not been attempted.

6. Save the new database

Sqlite>. Save Test.db

Doubts, using. Open when the database file already exists, execute the. Save test.db Invalid, prompting the database to be locked:

Actually I want to perform the close operation, however, is invalid.

But at this point the. Save command can be saved successfully with a different file name, and the contents of the new and old files are the same:

Use of the 7.SQL statement on the Sqlite.exe command line

From Command line Shell for SQLite page

8. My test

According to the official documents, TB11 was created.

9. Managing SQLite with graphical tools

I use the tool is Sqlitestudio, official website address.

After downloading, the SQLiteStudio.exe inside is the management tool.

Here's what I used Sqlitestudio to open the database created above test.db:

In fact, you can also use Sqlitestudio to create SQLite database files: You can also select the version of the database

The following is a database so.db created using Sqlitestudio:

10. Other

Check the SQLite support for UTF-8, a 2004-year article said version 3 has supported:

All right, here we go.

SQLite Database Preliminary

Related Article

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.