The main idea of this experiment is that when creating a database table,
By adding an additional field, that is, the timestamp field,
For example, when synchronizing table tt1 and table tt2,
By checking that the table is updated, the table is used
Solve Table 'mysql. servers' doesn' t exist
One thing I encountered today is that after upgrading the mysql database, I entered the data to create a remote user, and an error was returned.
Mysql> (42S02): Table doesn
This is caused by the loss
MYSQLSlow query Configuration
1. What is the use of slow queries?
It records all SQL statements that have been executed longer than long_query_time, and helps you find slow SQL statements to optimize these SQL statements.
2. How to enable slow
Mysql> select SQL _CALC_FOUND_ROWS * FROM tbl_name-> WHERE id> 100 LIMIT 10;Mysql> select FOUND_ROWS ();
With SQL _CALC_FOUND_ROWS, you can prepare the number of records that meet the where condition in advance during the query, and then you can
The first time I used hibernate to automatically generate a table that involves foreign keys for multiple tables, I encountered several errors using the @ onetoworkflow and @ ManyToOne annotations.
First, declare a base. There is no need to
LAST_INSERT_ID
Automatically return the first occurrence value set for the last INSERT or UPDATE operation as the AUTO_INCREMENT column. Refer to here
The ID that was generated is maintained in the server onPer-connection basis.
LAST_INSERT_ID is
(1) Optimize the table data type
The data type used by the table depends on the application. Although the length of fields must be redundant during application design, it is not recommended to leave a large number of redundant fields, which wastes
This is generally the case when you start to learn SQL statements.
The Code is as follows: SELECT * FROM table order by id LIMIT 1000, 10;
However, when the data reaches the million level, writing will slow down.
The Code is as follows: SELECT *
1. Connect to the database
Use the mysql_connect () function to establish a connection with the MySQL database
Source code: $ con = mysql_connect ("host name or IP", "username", "password") or die ("cannot connect to the database, it may be
--Stored Procedure and common process control syntax
/* This Code creates a stored procedure named "p4" and sets two int-type varchar parameters, s1, s2, and s3, or other data types, two internal variables x1 and x2 are created.
DELIMITER is
Compile and install mysql (Ubuntu10 64-bit) http://www.cnblogs.com/2018/p/3482259.html this introduction gcc form compile and install mysql
Then we use clang to compile and check the specific effect.
Compile and install
After testing, we can solve
When it comes to database data storage, it is often the only value problem. Some are restrictions imposed by primary keys, and some are business needs.
The following describes how to obtain or produce unique values:Create a test table tbl_user with
Recently, the company's Mysql database is often attacked. For some special reasons, it is impossible to take Mysql database into full Intranet environment and only provide some protection measures for Mysql. I have studied some common Mysql attack
The basic update syntax is to update the table set field = value where field = xxx
Existing Material Table materials (y_name, y_quantity), product Table a (p_name, p_quantity), to summarize the materials used by product a to materials
Mysql is not
The article "common methods of the query optimizer" lists some common optimization methods of the optimizer. The query optimizer also has some limitations while providing these features. These limitations are often improved with the upgrade of the
Recently, I decided to view the stored procedures written by my colleagues in the past, find some places where the code is not well written, and try to make modifications to make these processes run at a good speed. The following are the most common
Objectives:
Key-List model, trillions of nodes, distributed and scalable, ensuring certain performance and high availability
Basic Idea:
1. The list corresponding to the same key should be as centralized as possible
2. Restrict the table size
VARCHAR2 (size) is a variable-length string. Its maximum length is size bytes. The maximum value of size is 4000, and the minimum value is 1. You must specify the size of a VARCHAR2.
NVARCHAR2 (size), a variable-length string. the maximum length of
The differences between stored functions and stored procedures are as follows:
1. IN the function parameter list, the mode can only be IN.
2. The function must return a value. Its type is defined in the function header.
3. functions can be called
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