SQLite3 How to create a database

Source: Internet
Author: User
Tags sqlite sqlite database

Last contact Sqllite, do not know how to create a database, now do the following summary:

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 is OK, as a record of learning SQLite1: Choose to download the Sqlite.3exe file corresponding to your own system2: 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 DATABASE command: Sqlite3.exe "database name. Suffix name"The feeling of a cow here is that the database suffix name you create is arbitrary, but note that when you create a database under a 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 under 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 databaseCREATE TABLE command: CREATE TABLE tablename (field, field) It is clear from the command that the data type is not declared for the field when the table field is created in the SQLite database. this is different from other relational databases. Execute Insert command: INSERT INTO tablename VALUES (value,values) in front of, we can see, sqlite operation andSQL Server is not much different, it is noteworthy that the insert is different from SQL Server because it is allowed in SQL Server"Insert Table name VALUES (value,value)", such as the ellipsis-in. However, it is not allowed to use the ellipsis INSERT statement in SQLite. Execute DELETE statement: Delete from TableName where < condition >The Delete data syntax is the same as SQL Server,Delete Table The command is: DROP TABLE tablenameData Update command: UPDATE tablename SET field = value if a condition is required, add a where statement. Execute Query statement: SELECT *from tablename can follow where statement the above is the basis of sqlite additions and deletions to check the syntax and commands.

SQLite3 How to create a database

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.