================ Increase =========================
INSERT into ___ value ___, ___;
self-replicating
INSERT into Users (username,password,email,grade) Select Username,password,email,grade from Users
================ Delete =========================
Delete from _____ where _____;
================ Change =========================
Update ___ Set ___;
================ Cha =========================
Ascending and Descending sort: Select ____ from ___ ORDER by ID (ASC|DESC);
Fuzzy query: Select ___ from _____ where col-name like ' (%|_) ';
paged Query: Select ___ from ____ where ___ limit m,n;
Group query: Select ___ from ____ where ____ group by ____ having___;
Multi-Table query: (query result is a piece of data--Suitable for Website login user information query)
Example: Select ____ from ____, _____ where frist.id=second.id;
Subquery: Can be combined with a multi-table query to query a field (but heard there is a hidden danger of increased database load)
Select ____ from ____ where (select ___ from ____ where ___);
Inline table query: Data that conforms to the where, on condition based on two table data
Leftist table query: According to left table (D) existing data, to find out the right table (U) corresponding content
Right-side Table query similarly
Cases:
SELECT u.goods_id,u.goods_name,u.goods_num,u.use_point,u.use_time from Ll_doctor_use_point_record as U-left JOIN Ll_ Doctor_info as D on u.doctor_account_id=d.account_id WHERE d.account_id={$_session[' aid '} and use_time>= ' 2015-11-0 4 ' and Use_time <= ' 2015-10-12 ' LIMIT $start, $pageSize
============ aggregation function ===========================
Select COUNT () from ____ where ____;
Count,avg,sum,max,min
============ Change Table structure =======================
ALTER TABLE ____ Add school varchar (+) default ' JB ';
drop column ____;
Change school varchar (10);
Doc under Operation mysql////////////////////////////////////////
Backup and restore of ============= database ==============
Backup: Enter mysqldump-u[user name in cmd]-p[password] [database name to be backed up] > [Exported path]
Example: mysqldump-uroot-p123456 itcast > D:/backup.sql
Restore: Enter mysql-u[user name in cmd]-p[password] [the name of the database to be restored] < [imported file path]
Example: mysql-uroot-p123456 AAA < D:/backup.sql
Modify the current user's password (after setting the environment variable, it should be modified under DOS)
mysqladmin–u [user name]-p[password before modification] password [modified password]
View the name of the database currently in use
Select Database ();
===============mysql Common Commands ===============
Connecting to a database
mysql-h [Host address]-u [user name]–p #展示两种密码输入方式
Export Database
mysqldump–u [user name]–P [database to export] >[exported address]//export one or more tables in Itcast
Mysqldump–u [username]–p [Database to be exported]> [data table 1, data table 2]>[exported address]
Export all databases All
mysqldump–u [user name]–p–all–database>[exported address]
Exit database
Mysql>quit (Exit)
Create a new user
Grant [All/select,insert,update,delete] on [database]. [Table] to [user name]@[login host] identified by "[Password]"
Show the structure of a data table
mysql> describe table name; ==show columns from book;
To load data into a data table in text mode
mysql> Load Data local infile "d:/mysql.txt" into table name;
Import. sql File command
Mysql> source D:/mysql.sql;
Xampp-mysql Tips Shutdown Unexpectedly problem solving method
Solution:
1. Locate the Local Disk D: folder where Xampp is stored and click Open Folder
2. Locate the MySQL folder and click Open
3. Locate the Data folder and click Open
4. Find Ibdata1 This file and delete it
5. Re-enable MySQL to start successfully
This article from "DDD" blog, reproduced please contact the author!
Mysql_crud Base Statement