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