We know that a large MySQL table with massive records can be divided into several tables based on the primary key, time field, and condition field, or even stored on several servers.The only problem is that cross-server batch query is troublesome
DAYOFWEEK (date)
Returns the index of the week of the date (1 = Sunday, 2 = Monday ,...... 7 = Saturday ). These index values correspond to the ODBC standard.Mysql> select DAYOFWEEK ('2017-02-03 ');-> 3
WEEKDAY (date)Returns the week index of date (0
MySql General paging Stored ProcedureProcess ParametersCopy codeThe Code is as follows:P_cloumns varchar (500), p_tables varchar (100), p_where varchar (4000), p_order varchar (100), p_pageindex int, p_pagesize int, out p_recordcount int, out
Where 1 = 1? In SQL, writing such a sentence is the same as not writing it.
Select * from table1 where 1 = 1 is no different from select * from table1, and there are even many other statements, 1 <> 2, 'A' = 'A ', 'A' <> 'B' has only one purpose.
Database Engine Introduction
The MySQL Database Engine depends on how MySQL is compiled during installation. To add a new engine, you must recompile MYSQL. By default, MYSQL supports three engines: ISAM, MYISAM, and HEAP. The other two types of
The prompt command displays the current user, database, time, and other information at the mysql prompt.Copy codeThe Code is as follows:Mysql-uroot-p -- prompt = "\\ u \\ h :\\ d \\ r :\\ m :\\ s>"After the setting is successful:Copy codeThe Code is
1> query data in addition to the first three data tables.
At first, I thought of this statement.
SELECT * FROM admin WHERE userid not in (SELECT userid FROM admin order by userid LIMIT 3) order by userid DESC
But it will reportThis version of MySQL
Mysql updates some data in the field in the first case:Copy codeThe Code is as follows:Update tab set A = concat (substring (A, 1, 3), 'bbb '); Start from 1 character of A and add 'bbb 'to a. If the original value of A is '123aaa', it is updated to '
Recently, many SQL statements are written in the project, and variable assignment is often used, and I use SET and SELECT to achieve the effect.What is the difference between the two? When and which one?After online queries and personal exercises,
Difference between quotation marks and no quotation marks in Mysql Query When the database field ID is an integerSelect ID from table where ID = 1AndSelect ID from table where ID = '1'Both SQL statements are acceptable, but the first SQL statement
After installing MySQL, you will receive the following prompt:[Root @ localhost Desktop] # rpm-ivh MySQL-server-5.5.28-1.rhel5.i386.rpmPreparing... ######################################## ### [100%]1: mySQL-server ###################################
Data is very important. I want to know this with my toes. To ensure data security, we need to regularly back up data.
Here are some notes about data backup and restoration.
Data backup use the mysqldump command to back up a database
mysqldump -u
Mysql:Select count (*) from main_index;
However, a syntax error is reported here.
Method 1:Check the document as follows:Aggregate functions (AVG (), MIN (), MAX (), SUM () in column list clause are supported. arguments to aggregate functions can be
MySQLTuner: http://github.com/rackerhacker/MySQLTuner-perl
MySQLTuner usage:Downloading and using MySQLTuner is actually a very simple process:
Wget mysqltuner. plPerl mysqltuner. pl
If you 'd rather not invoke perl every time, just make it
This is the case: there are two tables, team table and people table. Each people belongs to a team and there is a field team_id in people.
The following table creation statement is provided:
Copy codeThe Code is as follows:Create table t_team(Id int
The default encoding of the mysql database is not UTF-8.
After installing mysql, start the service and log on to the mysql database. Run the show variables command to view the default encoding of the mysql database:
The character set of the
Sometimes, after reading the database, for the same result set, output on the same page may encounter multiple outputs, that is, multiple executions of mysql_fetch_array (), during the second execution, NO content is output without processing. In
1. Check whether logs are enabled:Show variables like 'Log _ bin ';
2. view the current Log File Name:Show master status;
3. Find out which binary log files are currently available:Mysql> show binary logs;
4. View mysql logs:Mysql-bin.000001 for
Find the installation location of your mysql database, as shown below:C: \ Program Files \ MySQL Server 5.1, which contains the my. ini file. Find the following lines:[Mysqld]Copy codeThe Code is as follows:# The TCP/IP Port the MySQL Server will
Mysql stored procedures are supported from version 5. Therefore, stored procedures are generally used. Today, I will share my understanding about the Mysql stored procedure.Some simple calls and syntax rules are not described here. There are many
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