MySQL is a third-party module that needs to install PIP install Pymysql First,After SQL executes, there are three data acquisition functionsCur.fetchone () #获取第一条数据, and so on and so on, the second execution will take the first one that removes the
1. According to the department number from high to low, wages from low to high list of employee informationSELECT * FROM Employee ORDER by dept_id Desc,salaryThe difference between the 2.union and union ALLAfter the table is joined with union, the
# When you write a stored procedure, you may encounter the time that you enter by entering the time of year # below by trying to fix the problem # idea: # Create an attempt for years, months here Create a 2010-2020 year drop view if exists v_year;
Last night jumped out of such a bug, hurriedly solve, for the database course design Assault JSP, really met a lot of problems ...Just like the utf8mb4_unicode_ci I used to say in MySQL,Then, the main reason for garbled characters is that the
See sort_buffer_size This parameter (the connect level parameter, MySQL5.7, the default value is 1048576 bytes, that is, 1MB) The default value is so small,Think about whether it is possible to turn up a little bit, anyway the memory is dozens of GB,
MySQL modifies character set problems for existing dataRan in the production environment for a long time, found that the Mysqlclient connection character set is the default latin1, we have always thought is utf8, resulting in this misunderstanding,
Three ways to do MySQL related queries:SELECT * from film JOIN film_actor on (film.film_id = film_actor.film_id);SELECT * from film JOIN film_actor USING (film_id); --You can use the using () when the two field names are the same for the associated
Today I learned a few of the complex usage of MySQL, specifically what the name has not been remembered very clearly =-= but the grammar is still remembered. The grammar that I learned today is not the most important thing, logic is. As long as the
MYSQL production scenario read/write separationM-------- à Sone-way synchronization to maintain data consistency can only be M Write data onMethod:1. control from library, connection user authorization2. Web The program writes to the master, reads
1. Explain analysis methodexplain {SQL}; Parsing query statements(1) The greater the number of ID column, the first execution, if the number is the same size, then from the top down to execute(2) Select_type query type: Simple, primary, dependent
The simple format that MySQL gives to user rights commands can be summarized as: Grant permissions on database objects to usersOriginal: http://www.cnblogs.com/zhuyibo/p/3980328.htmlA grant general data user, the right to query, insert, UPDATE,
About Char,varchar and text usually do not care too much, in general, probably now everyone is using varchar. But when the content to be stored is larger, what is the choice between varchar or text? I don't know......text, char, varchar are the data
The meaning of characteristic in MySQL Stored Procedure Definition,
The MySQL stored procedure is very wordy. Compared with the MSSQL or Oracle stored procedure, if it is not explicitly specified, it will implicitly specify a series of features
Several important MySQL variables and MySQL Variables
There are many MySQL variables, some of which are worth noting. The following describes some MySQL variables worth learning for your reference.
1 Threads_connected
Note that the value of this
MySQL optimization uses join instead of subquery and mysqljoin
Use JOIN instead of subquery (Sub-Queries)
MySQL supports SQL subqueries from 4.1. This technique can use the SELECT statement to create a single column query result, and then use this
Mysql uses instr for fuzzy query, instr fuzzy query
Using the internal function instr in mysql can replace the traditional like query method, and the query speed is faster.
Instr function. The first parameter is a field, and the second parameter is
MySQL optimizes the query speed when processing massive data.Reasons for slow query speed
1. No index or no index is used (this is the most common problem of slow query and is a defect in programming)
2. Low I/O throughput, resulting in a bottleneck
MySQL trigger,Trigger
In Mysql, a trigger is a database object related to table operations. When a specified event occurs on the table where the trigger is located, this object is called, that is, the Operation Event of the table triggers the
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