The content of this article is to introduce the method of operating the database (table, field, data addition, deletion, modification and query) in cmd command line mode. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
1. View databases, tables, data fields, data
1 First configure the environment variables to enter mysql or open the mysql command line or mysql visualization tool through one-click integration tools Open the command line
#Enter such an interface Different machines operate differently, so I won’t describe them one by one here
2 View all current databases
show databases;
3 Select (enter) database
use 数据库名;
4 View all tables in the current database
show tables;
5 View the field structure of a table
desc 表明;
6 Query table data
select * from 表名;
2. Create a new database, data table (table), data (add data)
1 Create a new database
create database 数据库名;
Enter Create a new database and create a table
2 Create a new table
CREATE TABLE 表名 ( 字段名字 数据类型 修饰 )
Note that there must be at least one field. The modification and data type will not be explained in detail here. The keywords are in capital letters and are used between fields. The last line is not used. .
3 Add data
insert into 表名 valuse(值,值);
##3. Modify the data table and modify the data
1 Modify the data table(1) alter table table name add field name type modification [added columns are at the end of the table](2) alter table table name add field name type modification after a certain column [add new column after a certain column] (3) alter table table name add field Name type parameter first【Add new column to the front】2 Modify dataupdate user set name=新值 where
4. Delete database, data table, data
1 Delete databasedrop database 数据库名;
drop table 表名
delete from 表名 where;
MySQL Video Tutorial!
The above is the detailed content of cmd command line mode to operate the database (tables, fields, data addition, deletion, modification and query). For more information, please follow other related articles on the PHP Chinese website!