Suppose there is a Student score table (CJ) as followsName Subject ResultsZhang San Language 80Zhang San Mathematics 90Zhang San Physics 85John Doe Language 85John Doe Mathematics 92John Doe Physics 82Harry Mathematics 60Want to becomeName Language
Or a previous project that requires a script to manage MySQL,Originally used to write a C, because at that time for Shell confused Ah, later found that C relative to the shell is still inconvenient,After all, the shell changed super-fast
After installing Python, install python-mysql to connect to MySQL database, http://sourceforge.net/projects/mysql-python/, installation is very simple, point next to it, But the version that corresponds to your Python version, otherwise the egg
The following two ways must all be setCharacter Set:latin1Collation:latin1_swedish_ciDisplay Encoding Method:Show Character SetThank you, Su Yong, I rubbed his class, heheDisplay first, then set. Recommended Utf-8 (see attachment)
Show
A lock is a mechanism by which a computer coordinates multiple processes or threads concurrently accessing a resource . In a database, data is a resource shared by many users in addition to contention for traditional computing resources such as CPU,
CREATE TABLE table_name (ID int unsigned primary key auto_increment,Username varchar (+) NOT NULL,Nickname varchar (+) NOT null default ' anonymous ',Unique key (username));CREATE TABLE IF not EXISTS ' test ' (' id ' int (ten) unsigned not NULL auto_
The optimization of MySQL is very important. The other most commonly used and most need to optimize is limit. MySQL's limit brings great convenience to paging, but when the amount of data is large, limit performance drops sharply.Same as 10
Tag:os strong sql mysql string rom rac ef 1, intercepts the string from the left, and the leftmost (str, length) Description: Ieft (truncated field, intercept length) Example: Select Left (content,200) as abstract
CREATE TABLE Teacher (t_id int primary Key auto_increment,#auto_increment autogrow requires an integral type, and an index is requiredT_name varchar (20),T_class varchar (20),Days tinyint unsigned);#设置自动增长的起始值, the data inserted will automatically
mysql> Select Desc,status,play_time,push_type, interval " from Cms_push; ERROR 2006 (HY000): MySQL server has gone awayno connection. Trying to reconnect ... Connection ID: 700current database:xxx_cmserror 1064 (42000): You are having an
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
Create function example of MySQL user-defined FUNCTION, createfunction
mysql>mysql> delimiter $$mysql>mysql> CREATE FUNCTION myFunction-> (in_string VARCHAR(255),-> in_find_str VARCHAR(20),-> in_repl_str VARCHAR(20))->-> RETURNS VARCHAR(255)-> BEGIN-
MySQL update and Deletion
The SQL statement for updating and deleting operations is relatively simple. However, when using UPDATE, pay attention to the limitations of the WEHER condition. The following statement only updates the email address with
High Availability of MySQL-keepalivd + mutual Master/SlaveObjective: to configure a keepalived Hot Standby architecture and master-slave ReplicationPlanning:Master1 zlm177 192.168.17.177Master2 zlm188 192.168.17.188Vip 192.168.17.166Environment: Red
Use mysqlbinlog to recover data based on location or time pointUse mysqlbinlog to restore data based on location or time pointMySQL backup generally uses full backup and log backup. For example, a full backup is performed every day and a binary log
Optimized query statements in the MySQL database.
Most of the time, the system performance bottleneck for websites built based on php + MySQL is often found in MySQL, and the most frequently used statements in MySQL are query statements. Therefore,
Basic implementation principle of group by in MySQL
Because group by actually performs sorting operations, and compared with order by, group by mainly only performs grouping operations after sorting. Of course, if other Aggregate functions are used
Create advanced connections for MySQL
SQL allows an alias for a table. The two main reasons for doing so are:The SQL statement can be shortened; the same table can be used multiple times in a single SELECT statement; the alias is used to represent
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