The methods for inserting data into a MySQL table include: 1. INSERT statement; 2. LOAD DATA INFILE statement to load CSV files in batches; 3. Direct insertion using client tools.
MySQL How to input data after creating the table
After creating the table, you can insert into the MySQL table through the following methods Data:
1. INSERT statement
<code class="sql">INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...);</code>
For example:
<code class="sql">INSERT INTO customers (name, email, phone) VALUES ('John Doe', 'john.doe@example.com', '123-456-7890');</code>
2. LOAD DATA INFILE statement
This method can be used to batch load data using CSV or other delimited files.
<code class="sql">LOAD DATA INFILE 'file_path.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (column1, column2, ...);</code>
For example:
<code class="sql">LOAD DATA INFILE 'customers.csv' INTO TABLE customers FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (name, email, phone);</code>
3. Use client tools
You can directly insert data into the table through MySQL Workbench or other client tools.
Note:
The above is the detailed content of How to enter data after creating a table in mysql. For more information, please follow other related articles on the PHP Chinese website!