Fortune Telling Collection - Zodiac Analysis - How to create a constellation table in mysql _ How to create a MySQL data table
How to create a constellation table in mysql _ How to create a MySQL data table
1. You can use the create table statement to create the table. Create a table in the form of:
Create a table table name (column declaration);
Take creating the people table as an example. Student id, name, gender and age will be stored in the table:
Create a table person (
Id int unsigned not null auto_increment primary key,
Name char(8) is not empty.
The gender character (4) is not empty,
Age is unsigned and not empty.
);
Among them, auto_increment can increase the id field of type Int by 1 at a time.
2. insert the data into the table using the insert statement.
The insert statement can be used to insert one or more rows of data into a database table. The general form used is as follows:
Insert [into] table name [(column name 1, column name 2, column name 3, ...)] value (value 1, value 2, value 3, ...);
The content in [] is optional. For example, to insert a record into the people table created in the previous step, execute the following statement:
Insert into the person (name, gender, age) value ("Zhang San", "Male", 21);
3. If you want to query whether the insertion is successful, you can query the statement through select. Its form is as follows:
select * from people
Extended data:
When mysql inserts a lot of data, using insert into will become very slow. Mysql has three ways to improve the speed of insert into:
1, first insert speed-up method:
If there is already a lot of data (millions) in the database, then ok? Add bulk_insert_buffer_size in mysql configuration. This parameter defaults to 8M.
For example: bulk _ insert _ buffer _ size =100m;
2. The second mysql insertion speed-up method:?
Rewrite all insert into statements as? Insert? Delay to
The difference between this delayed insertion is that the result is returned immediately and the insertion is processed in the background.
3. The third method: insert multiple pieces of data at a time:
Insert multiple pieces of data, such as:
Insert table values ('1 1',' 1 1'), ('22',' 22', ('33',' 33') ...;
- Related articles
- The mouth is particularly cheap, and it always pokes people's heart and lungs.
- The most worthy constellation man entrusted by a woman
- Don't be yourself, always like to imitate other people's constellations.
- Sketch of Ancient Landscape Illustration ¡ª¡ª How to draw beautiful ancient eyes
- 7.3 Constellation _73 Constellation
- Which grade is higher, Ba Jin or Le Fei?
- How many stars does Sagittarius consist of?
- What about Capricorn?
- I want to watch China constellation _ I want to watch the video of China constellation.
- Friends, talk about your health care, ok?