Zeng: All programming is data-centric, and 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
To insert the data first, 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 basic formats for inserting data, the first of which is the specified column, and the syntax is as follows:
INSERT into table_name (column1, Column2, Column3,... columnn)] VALUES (value1, value2, value3,... Valuen);
For example:
INSERT into Company (id,name,age,address,salary) VALUES (1, ' Hanfeng ', +, ' Hubei ', 10000.00);
In this way, only the NOT NULL column is given a value, and the other columns that are not specified can be empty
3 Second way: Full column
The second way to insert is to not know the column, but to specify a value 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
Basic syntax:
DELETE from Table_namewhere [condition];