Learn MySQL time is not long, the database operation is nothing more than add records, find records delete records and modify records.
Summed up some of the following commands to share with you:
Connection command: mysql-h[host address]-u[user name]-p[user Password]
Creating databases: Create database [library name]
Show all databases: show databases;
Open database: Use [library name]
Current Selected Library Status: Select Database ();
Create data table: Creation table [table name] ([Field name] [Field type] ([field requirement]) [Field parameter], ...);
Display data table field: describe name;
Current Library data table structure: show tables;
Change a table
ALTER table [table name] ADD COLUMN [field name] DATATYPE
Description: Adds a field (no syntax for deleting a field).
ALTER table [table name] ADD PRIMARY KEY ([Field name])
Description: Change the definition of a table to set a field as the primary key.
ALTER table [table name] DROP PRIMARY KEY ([Field name])
Description: Deletes the definition of the primary key.
Displays the current table field: Show columns from TableName;
Delete library: drop database [library name];
Delete tables: drop table [table name];
Data manipulation
Add: INSERT into [table name] VALUES (', ',...... sequentially arranged data);
Query: SELECT * FROM [table name] WHERE ([condition]);
Index: CREATE index [index file name] on [table name] ([field name]);
Delete: delete from [table name] WHERE ([condition]);
Modified: UPDATE [table name] SET [modify content such as name = ' Mary '] WHERE [condition];
Import External Data text:
1. Execute the external SQL script
Executing on current database: MySQL < input.sql
Execution on the specified database: MySQL [table name] < Input.sql
2. Data incoming commands load data local infile "[file name]" into table [table name];
Backing Up the database: (Dos)
Mysqldump--opt SCHOOL>SCHOOL.BBB
http://www.bkjia.com/PHPjc/631193.html www.bkjia.com true http://www.bkjia.com/PHPjc/631193.html techarticle Learn MySQL time is not long, the database operation is nothing more than add records, find records delete records and modify records. Summed up some of the following commands to share with you: Connect command: Mys ...