Copy Code code as follows:
SELECT A. ' Table_schema ' as db_name, a. ' table_name ', A. ' Table_rows ', A. ' ENGINE '--, a.*
From
Information_schema. ' TABLES ' a
Left JOIN information_schema. ' Table_constraints ' b
On a. ' table_name ' =
DayOfWeek (date)
Returns the week index of date (1= Sunday, 2 = Monday, ...). 7= Saturday). These index values correspond to ODBC standards.Mysql> Select DayOfWeek (' 1998-02-03 ');-> 3
Weekday (date)Returns the week index of date (0= Monday, 1 =
The project needs to reinstall a MySQL server on the existing server, it is very difficult, because it was in my notebook before the test, its system is Ubuntu, what path Ah, start the way ah. It's not the same, so this time it still makes me tangle:
Today in doing experiments using MySQL database, the user password forgotten, let me also looking for a half-day: now to introduce my own method: the use of MySQL itself to test the function.
Copy Code code as follows:
Mysql> select
Installed a 5.5 version of MySQL, the character set appears to be a problem, the previous MySQL server is through the MY.CNF configuration file in the configuration can be, but today how do not always error:
There was also no error log configured
Order by is understood in English as the sort of row, and the default is ascending. The ordered by must be followed by a list of field names, which can be multiple field names.Group By is understood in English as grouping. You must have an aggregate
Before tuning:
Select COUNT (t.id) from Test t where T.status = 1 and T.id not in (select distinct a.app_id from Test2 a where A.type = 1 and a.rule_id in (152, 153, 154)) 17:20:57 laojiu> @plan PLAN_TABLE_OUTP UT ————————————————————————————
Often the application needs to flip the data in the table, and if the volume of data is large, it often poses a performance problem:
Root@sns 07:16:25>select Count (*) from reply_0004 where thread_id = 5616385 and deleted = 0;
+ ———-+
|
In 5.1.46, the optimizer made a little change in the selection of the primary key:
Performance:while looking for the shortest index for a covering index scan, the optimizer did not consider the full row l Ength for a clustered primary key, as in
There is one requirement: SELECT COUNT (distinct Nick) from User_access_xx_xx;
This SQL is used to count the user's access to the UV, because the amount of data in a single table is more than 10G, even if you add Nick's index to the
Order by DESC/ASC limit M is a scenario I often encounter in MySQL SQL optimization, and its optimization principle is also very simple, that is, by using the ordering of indexes, the optimizer scans the sequence of indexes and stops the scan after
We often encounter some customers at work Tps\qps are not too high, but disk consumption is very large, once the single instance space is too large, like memory, network, CPU and backup will increase the corresponding cost. Perhaps just because the
Index-related
1. Query (or update, delete, can be converted to query) does not use the indexThis is the most basic step, requiring the SQL execution explain to see if the index is used in the execution plan, and focus on the Type=all, key=null
Assuming your database is MySQL, the classic "8-hour problem" may occur if the data source is improperly configured. The reason is MySQL by default, if a connection is found to be idle for more than 8 hours, the connection will be automatically
For example, an article table Article (id,category,insertdate), now use SQL to find the most recent time in each type of the first n data composition of the collection, a good code, to retain the standby
Select a1.* from
Article as A1
What is a collection operation?
Generally, a join operation is considered a horizontal operation between tables because the operation generates a virtual table that contains columns from two tables. And I've summarized the set operations here, and
Problem:
When I look at the code of a previous developer, I see
WHERE p.name NULL
What does the symbol mean in this query? Is it the same as the = number? Or is it a grammatical error? However, no errors or exceptions are displayed.
You can open the MySQL information_schema database if you want to know the space occupied by each table in the MySQL database and the number of rows recorded in the table. There is a tables table in this library, the main fields of this table are:
Write down the two ways PHP connects to MySQL.
Mock the data first, and you can execute SQL.
/* CREATE DATABASE * *
IF not EXISTS ' test ';
/* Select database * * Use
' test ';
/* CREATE TABLE
/IF not EXISTS ' user ' (
name varchar, age
Because when you do a project you need to filter out parts of the product list so that it is at the end of the list, but all products are sorted by update time.
After studying the database structure of the system, decide that the product that will
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