This article introduces a simple method of importing database tables. It only needs to use commonly used software on the computer. There is no need to install third-party database management software. I personally think it is very effective, and it has been made into a script to facilitate next time. use.
1. Create a new table file to be imported, as shown in the figure below.
2. Take the MySQL database as an example, open the MySQL x.x (version number) Command Line Client (if it is Oracle DB Then open Sqlplus) and enter the root password.
3. This article omits the database establishment process and directly creates the table and enters
CREATE TABLE test ( name VARCHAR(100) NOT NULL, sex VARCHAR(100) NOT NULL, age INT UNSIGNED NOT NULL );
Create the form test, as shown in the figure below. The red circle shows that the test form has been created successfully.
#4. Next, add insert statements in batches to the table to be inserted. First, add the front part insert into test values(', first before the name column. Insert an empty column, as shown in the figure.
#5. Fill in the first column with insert into test values(' , you can fill in the first column by dragging it.
#6. Insert an empty column before gender. , use the same method as above to insert ',', as shown in the figure below
#7. Use the same method. Insert the remaining relevant characters as shown below
#8. Finally, copy and paste the table into Notepad. Or other simple text processing software, next remove the relevant useless information and spaces indicated by the red circle
9. .Delete the useless information in the first line, press Ctrl+H or find the replace function directly in the notepad edit menu and replace the useless spaces
.
10. Now that the script content is ready, copy and paste it directly to the console for testing. The test results show that the table content has been inserted correctly.
Note:
is only suitable for general-sized table insertion, if the amount of data is large It is definitely faster to use third-party database management tools
.
The above is the detailed content of How to import table files to MySQL database or Oracle. For more information, please follow other related articles on the PHP Chinese website!