MySQL INSERT statementWhen to use single quotes, when not?1. Create a table firstCREATE TABLE User (Username varchar (255),Age int,Marry Boolean,Birthday Date);Note that there must be no comma before the last parenthesis, otherwise an error "2.
The previous blog describes a case where memory spikes due to SQL query Information_schema tables.Today, by the way, a THD memory is monitored:Let's introduce the memory of MySQL:1. In-thread memory: thd->mem_root, during the execution of SQL, the
Scheduled backups:1. Create a backup file to store the directory2. Create a backup script backup.sh#!/bin/bashDbuser=db_backDbpasswd=passwordDbname=db_nameServer=localhostsave_dir=/dbbackup/logfile= "$save _dir" Backup.lognewfile= "$save _dir"
1. Check if the event is turned onSHOW VARIABLES like ' Event_scheduler ';2. Open EventSET GLOBAL event_scheduler = on;3. Create an EventDELIMITER $$--SET GLOBAL Event_scheduler = on$$--Required for event to execute and not createCreate/*[definer = {
1. Limit usage in SQL statements SELECT * FROM table ... limit start position, number of operation bars (start position starting from 0) SELECT * FROM Table ... limit 0, 20 (take front 20) SELECT * FROM Table ... limit 10, 20 (starting from 11 fetch
--mysql SQL optimization-------------------2014/07/23case of several order byAt first glance the problem seems a bit complicated, and we start with the simplest case.Use this table to illustrate: (10w rows of data)1. The simplest Order――order by
Example 1:Using this query, you get the value of Ifavoriteid,ifavusertype, Cuser,iarticleid,dfavoritetime five fields:SELECT Ifavoriteid,case where Ifavusertype = 0 Then ' news manager 'When ifavusertype = 1 Then ' merchant 'When ifavusertype = 2
Case: The following SQL statement causes the MySQL instance memory to skyrocket: SELECT * FROM tables where table_name not IN (select table_name from partitions GROUP BY TABLE_NAME have COUNT (*) >1); MySQL 5.5, 1w+ 's InnoDB table.Let's look at
Check official documents: FROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format) Returns A representation of theunix_timestampargument as a value in‘YYYY-MM-DD HH:MM:SS‘orYYYYMMDDHHMMSSformat, depending on whether the function was used
A strange thing in mysql
I have a table in my database. I suddenly cannot open it today ..
In phpmyadmin, click the table prompt "Unknown column 'operator' in 'where clause order'", which means there is no operator field.
Although this table
MySQL search: WHERE multi-Condition
WHERE can be searched by multiple conditions.
The products table is as follows:
After a WHERE, search by and based on two conditions and three conditions: VcD4KPHA + pgltzybzcm9
Mysql merges values of the same column
I have the following query conditions:
I want the final display Effect
VcD4KPHA + pgltzybzcm9 "http://www.2cto.com/uploadfile/Collfiles/20140712/2014071209025946.png" alt = "\">
Merge group_name with
MySQL calculated Field
Calculated Field
The tables in the database are stored by columns, but sometimes the information the client wants is a combination of several columns or the sum value. This combination or summation action can be done in the
06-MYSQL data type date string06-MYSQL data type date string
---- Integer type
Integer type
Bytes
Value Range
Value Range
Tinyint
1
Signed-128Unsigned 0
Signed 127No-symbol 255
Smallint
2
Signed-3276
MySQL character encoding system (I)-data storage Encoding
MySQL has been installed many times, and every time it will be entangled in the character encoding configuration of the database, so I decided to thoroughly clarify it this time.
The
MySQL summary dataSummary data sometimes operations on a data table are not the data itself, but the summary of the data in the table, such as the average, maximum, and minimum values of a column of data. MySQL provides functions for these commonly
MySQL group dataFor Grouping comprehension groups, see the next example. First, we print the products table as follows:From the table above, we can see that each vendor has several products. How can we count the number of products in each vendor at
Retired Note 2 # MySQL = lambdasql: SQL + & #39; SourceCode4InnoDB & #39;
Macro UNIV_INLINE> univ. I
Struts:
MySQL Handler APi Embedded API
Row/Cursor
B + Tree Index Insert Buffer
Manager: Transaction Lock Buffer Log Storage Resource
Manager:
Retired Note 1 # MySQL = lambdasql: SQL + & #39; SourceCode4ExplainPlan & #39;
The Mysql query execution process is roughly divided into four stages:
Syntax analysis (SQL _parse.cc )
> SQL _resolver.cc # JOIN. prepare
Generate logical query plan
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service