mysql add, delete, modify and query statement operations: 1. Use the select statement to query, the code is [SELECT * FROM biao1]; 2. Use insert to insert data, the code is [INSERT INTO biao1 ()]; 3. Use delete delete data.
mysql add, delete, modify and query statement operations:
1. Open sqlyog to create a new connection to manage the database and click on the file -》New connection, or directly click the green button in the picture
Related learning recommendations: mysql video tutorial
2. Then fill in the installed mysql database information, host address, user name, password and database name
3, then click "Link", If there are no errors in the information, the connection information and database-related information will be displayed on the left, and the query box on the right can be used
4. First, test the query statement in the query maniac. , query all columns that meet the conditions, and query for specified columns
1.SELECT * FROM biao1
2.select name form biao1
3.SELECT * FROM biao1 WHERE id =6
Select the query statement and click the execute button respectively to display the results in the picture
5. Insert data into the data. Fill in the query box with INSERT INTO biao1(name1,age) VALUES('newly added 1','1000') and then click the execute button. If successful, a statement will be executed. When running all the query statements, the newly inserted information will be found. Can be queried
#6. Next, execute the modification statement and write the following code in the query box UPDATE biao1 SET name1="This is a modification",age='2000' WHERE id=20 Change "New 1" in the database to "This is a modification", change "1000" to "2000", select the statement and click Execute, and then query again. The following results will appear, indicating that the modification is successful.
7. Next, delete the data that already exists in the database through id, delete the
just modified data in the database, and pass DELETE FROM biao1 WHERE id='20', after selecting and executing, you will find that the previous data has been deleted. If you execute the increase, you will find that the id has become 21
Related learning recommendations: Programming video
The above is the detailed content of What are the operations of mysql add, delete, modify and query statements?. For more information, please follow other related articles on the PHP Chinese website!