Commonly used SQL commands of SQLite

Source: Internet
Author: User

~~~~~ Some commonly used SQL commands for SQLite ~~~~~~~~~~~

 

Create a database table:

 

Create Table if not exists

Table-Name (column-def1, column-def2)

 

Table-name: the name of the database table.

Column-Def: column definition of the table

Column-Def is further divided into: column-name type-name column-Constraint

Type-Name: Commonly Used integer/varchar

Column-constraint: commonly used forms include primary key

--------------------------------------------------------------------

Insert records into existing database tables:

 

Insert

Table-Name (column-name1, column-name2) values (expr1, expr2)

------------------------------------------------------------------------

Delete a record from an existing database:

 

Delete from

Squalified-table-name where expr

-------------------------------------------------------------------------

 

Delete A database table:

 

Drop table if exists table-name

 

Note: The drop TABLE statement removes a table added with the create table statement. the name specified is the table name. the dropped table is completely removed from the database schema and the disk file. the table can not be recovered. all indices and triggers associated with the table are also deleted.

 

------------------------------------------------------------------------------

 

Modify the record in the existing database table:

 

Update qualified-table-name set column-name = expr where expr

 

 

Note: The update statement is used to change the value of columns in selected rows of a table. each assignment in an update specifies a column name to the left of the equals sign and an arbitrary expression to the right. the expressions may use the values of other columns. all expressions are evaluated before any assignments are made. A Where clause can be used to restrict which rows are updated.

 

------------------------------------------------------------------------------

 

Select a qualified record from the existing table:

 

Select (distinct/all) from join-source where expr group-by ordering-term haing expr order by ordering-term

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.