SQLite Code-2.0

Source: Internet
Author: User
Tags sqlite

Copyright: Little White qq:99565687

DOS command:
①sqlite3--into sqlite3 inside to operate
②sqlite3 database name--declares a database to be created
③.databases--creating a declared database
④.tables--to view all table names in the entered database
⑤.output file name--The output data of the following command is stored in the specified file
⑥.dump Database/table-the source code of the output database or table
⑦.schema Database/table--An SQL statement that outputs a database or table

SQL statements:

CREATE TABLE Table name--Creates a table in the database opened or entered.
(
ID integer,--the Data ID field name of the integer type in the table
Name text,--The field name of the text type data name
Float real,--field name for floating-point type data float
Free null,--field name to fill in empty type data
SJ blob--fill in a data type of data SJ stores the field names according to the data that was originally populated.
);
A field name is not a stored data, it is simply the name of the file where the data is stored.

Not NULL is the column data can not be empty when added
Null can be empty when adding column data
--placed behind the field name statement.
DROP table name--Deletes the tables in the current operation's database.
ALTER TABLE name RENAME to new table name--Modify the name of the tables
ALTER TABLE table name add column field name data Type--Add new columns
CREATE table new table name as Select field Name 1, field name 2, field name 3 from old table name--Gets the pasted data into the new table name based on the field name.


Insert into table name (field name 1, field name 2, field name 3,....) VALUES (data 1, data 2,.....) --The text data needs to be "enclosed."
--Add a piece of data, you can select a column to add, or you can add it all by default. Null means not filling in the data!
SELECT * FROM table name--View all data information in tables!

Update table name set known field name = Data to be updated, known field name = data to be updated where known field name = Known data
--here, depending on the conditions behind the where to update the row of data, and then according to the field name to update the data to update, the statement is not executed sequentially, but based on the condition. So if you know a known data, you can change all the other data in that row.

Delete from table name where condition--based on the criteria to determine which row to delete, and if there is no condition, delete all data in the table by default.

SELECT * FROM table name--Query all data
Select a field name known as the from table name--Query the column data within the specified field name.

Select distinct other-data culling is repeated when querying the data.

"Column name specified"
"* Indicates query all columns"
"from specifies which table to query"
"Distinct optional, whether to exclude duplicate data when displaying the results"

PS: Many people say that they want to get started with SQLite quickly, then I will provide some SQL methods/and statements, I hope you can learn in one day!

Then this chapter version will be updated to 3.0, so please look forward to it.

SQLite Code-2.0

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.