In Windows, when the MySQL service is started and disabled, netstopmysqlnetstartmysql (where mysql is the MySQL service name) displays all databases showdatabases, sets the current database usedatabasename, and displays the current database selectdatabase (); display the showtables table in the current database; common SQL commands
In Windows, the MySQL service starts and disables the net stop mysql net start mysql (where mysql is the MySQL service name). show databases is displayed for all databases. Set the current database use databasename; displays the current database select database (); displays the tables in the current database show tables; commonly used SQL commands
Start and close the MySQL service in Windows
Net stop mysql
Net start mysql
(Mysql is the MySQL service name)
Show all databases
Show databases;
Set the current database
Use databasename;
Show Current Database
Select database ();
Display tables in the current database
Show tables;
Common SQL commands:
(1) Data Record Filtering:
SQL = "select * from data table where field name = Field Value order by field name [desc]"
SQL = "select * from data table where field name like '% Field Value %' order by field name [desc]"
SQL = "select top 10 * from data table where field name order by field name [desc]"
SQL = "select * from data table where field name in ('value 1', 'value 2', 'value 3 ')"
SQL = "select * from data table where field name between value 1 and value 2"
(2) update data records:
SQL = "update data table set field name = field value where condition expression"
SQL = "update data table set field 1 = value 1, Field 2 = value 2 ...... Field n = value n where condition expression"
(3) Delete data records:
SQL = "delete from data table where condition expression"
SQL = "delete from data table" (delete all data table Records)
(4) add data records:
SQL = "insert into data table (Field 1, Field 2, Field 3 ...) Valuess (value 1, value 2, value 3 ...) "
SQL = "insert into target data table select * from source data table" (add records of source data table to target data table)
(5) Create and delete data tables:
Create table data TABLE name (Field 1 type 1 (length), Field 2 type 2 (length )...... )
Example: create table tab01 (name varchar (50), datetime default now ())
Drop table data TABLE name (permanently delete a data TABLE)