Common commands for database operations:

1, show DATABASES // MySQL database

2, show create database;

The encoding of data in the database is utF8, the default encoding specified when the database is installed

Use db_test_2021 // use db_test_2021

5, select the database (); // View the database in use:

Common commands for database tables

Create table name ();

Field name type (length) constraint,

Field name type (length) constraint

 );

Create table with constraints

Insert data into table

SELECT name from student_test WHERE id = 100; // Query the names of the student_test table whose ID is 100

4, UPDATE student_test set name=’xuzengzeng’, sex=’man’ WHERE id=101; / / change the Id = 101

5, DELETE FROM student_test WHERE name = ‘wjy’;

6, show tables; // Check all tables in the database:

Desc student_test // Check the structure of the student_test table

ALTER TABLE student_test add age INT(3); Modify the table to add columns

Reference: dev.mysql.com/doc/refman/…