SQLite Learning Note 5: Inserting data, querying data, and deleting data

Source: Internet
Author: User

Zeng: All programming is data-centric, and I think it makes sense.

The so-called database database, no data called what database, then see how to insert data in the table.


One insert data

1 Creating a Table

First, to insert data, you need to create a table first:

CREATE TABLE Company (   ID int PRIMARY KEY isn't     null,   NAME           TEXT not    null,   age            INT     not NULL,   ADDRESS        CHAR (+),   SALARY         REAL);


2 First way: Specify columns

There are two main formats for inserting data, the first being the specified column, and the syntax for the following:

INSERT into table_name (column1, Column2, Column3,... columnn)]  VALUES (value1, value2, value3,... Valuen);
Like what:

INSERT into Company (id,name,age,address,salary) VALUES (1, ' Hanfeng ', +, ' Hubei ', 10000.00);

This insertion method only needs to give the NOT NULL column a value, other columns that are not specified can be empty


3 Another way: Full column

Another way to insert is to not know the column, but to specify values for each column, it is important to note that the order must be consistent.

INSERT into table_name VALUES (value1, value2, value3,... Valuen);


Two data query

1 Querying the specified column

Query values a value for the specified column in a table:

SELECT column1, Column2, COLUMNN from table_name;

2 querying the values of all columns in a table

SELECT * FROM table_name;


3 Setting the output format

. Header on-Displays a list of. Mode column--sets the column to its


Three delete data

The basic syntax:

DELETE from Table_namewhere [condition];







SQLite Learning Note 5: Inserting data, querying data, and deleting data

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.