SQLite initial knowledge (SQLite download installation and create Database method)

Source: Internet
Author: User
Tags sqlite sqlite database sqlite download sqlite query win32

interface, like MySQL, is the cmd interface, but not the database created in SQLite.exe:

First or the CMD under the use of SQLite online has been a lot, do not do too much to repeat. Roughly speaking the corresponding command on the line, as a learning SQLite a record 1: choose to download the corresponding system of the Sqlite.3exe file

SQLite is known for its 0 configuration, so it does not require complex setup or management. Here's a look at how to install SQLite on your system.

install SQLite on Windows

Follow these steps:

    • Open the official SQLite website, go to the download page-http://www.sqlite.org/download.html and download the precompiled Windows binaries.

    • Download sqlite-dll and sqlite-shell zip files as well as sqlite-tools-win32-x86-3170000.zip files.

    • Create a folder: D:/software/sqlite and place the extracted files above. and set the system variable to increase in path: D:/software/sqlite so that SQLite can be run from anywhere with CMD.

    • Enter the D:/software/sqlite directory and open the sqlite3 command. It will be as follows:
D:\software\sqlite> sqlite3SQLite version 3.18.0 2017-03-28 18:48:43Enter ".help" for usage hints.Connected to a transient in-memory database.Use ".open FILENAME" to reopen on a persistent database.sqlite>
Shell

The above method helps to create the database permanently, attach the database, and detach the database. There is another way to perform crud operations in SQLite. In this method, you do not need to set the path. Let's take a look at how to operate-

    • Just download the SQLite precompiled binary zip file: sqlite-tools-win32-x86-3170000.zip .
    • Unzip to directory: D:/software/sqlite .
    • Directly double-click sqlite3.exe the Run application to get the following results-

You can now perform the SQLite query here. But here, the data is temporary, once you shut down the computer, you will lose all the data records that have been manipulated. Because you cannot create, attach, or detach a database using this method.

Installing SQLite on Linux

Currently, almost all Linux operating systems publish SQLite as part of it. You can use the following command to check if SQLite is installed on your machine.

$ sqlite3SQLite version 3.7.15.2 2013-01-09 11:53:05Enter ".help" for instructionsEnter SQL statements terminated with a ";"sqlite>
Shell

If you don't see the results above, then you don't have SQLite installed on your Linux machine. You can install SQLite by following these steps:

Open the Go to sqlite download page (http://www.sqlite.org/download.html) and download the file from the Source code section: sqlite-autoconf-*.tar.gz .

Follow these steps:

$ tar xvfz sqlite-autoconf-3071502.tar.gz$ cd sqlite-autoconf-3071502$ ./configure --prefix=/usr/local$ make$ make install
2: After decompression, use the cmd command to enter the path of the Sqlite3.exe file to execute the command can be manipulated to do the corresponding operation. If you need to exit after entering the database, Windows can exit by pressing CTRL + C. For example: Create a Database command: Sqlite3.exe "database name. suffix"   Here's a little bit of a cow. The name of the database suffix created is arbitrary, Note, however, that the creation of the database is performed under the Command box.   If you do not create a table for the database, you cannot see the database file, so you must create a table.   For example: at the cmd command prompt, enter Sqlite3.exe test.db (test.db is the database name) carriage return, after execution, the command prompt automatically jumps   to the "sqlite>" state. This database is still not visible at this time! Create or close a table sqlite3  for example: Create TABLE User (' username ');  you can see this database file in the folder where Sqlite3.exe is located   If you still use Sqlite3.exe test.db to access this database the next time you want to use this database    create a table command: CREATE TABLE tablename (fields, fields)   here from the command can be clearly seen, When you create a table field in the SQLite database, the data type is not declared for the field.   This is different from other relational databases.   Execute insert command: INSERT INTO tablename VALUES (value,values) in front of, we can see, sqlite operation and  sqlserver nothing much difference, noteworthy is that, Inserts are distinguished from SQL Server because of the fact that the   Insert Table  name values (value,value) is allowed in SQL Server to use an elliptical wipe. However, it is not allowed to use the ellipsis INSERT statement in SQLite.   Execute DELETE statement: Delete  from tablename where < condition >  Delete data syntax same as SQL Server,   Delete table The command is: DROP TABLE tablename   Data Update command: UPDATE tablename SET field = value if a condition is required, add a where statement.   Execute query statement: SELect *from TableName can follow the WHERE statement   above is the basis of SQLite's additions and deletions to check the syntax and commands.

SQLite initial knowledge (SQLite download installation and create database method)

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.