SQL queries this week's questions this month
--- Calculate the number of days for differenceSelect datediff (day, '2017-01-01 ', getdate ())-- 1. The first day of a monthSelect dateadd (mm, DATEDIFF (mm, 0, getdate (), 0)-- 2. Monday of the
Use pipelines to migrate data and pipelines to migrate dataWhen the disk space is insufficient, use the named or anonymous pipeline to migrate and import data. Pay attention to the permission of the named pipeline.
0. Name PIP 0 [pg @ h1 ~] $ Psql
It took a long time to see a friend importing data! There are actually a lot of quick methods to work out! There are many ways to insert data into a table, but the performance varies with different methods.
It took a long time to see a friend
In my work practice, I found that poor SQL statements often come from inappropriate index design, unfilled connection conditions, and unoptimized where clauses. The following section describes the database optimization issues. If you need a friend,
And exists (select * from sysobjects) // you can check whether it is MSSQL.
And exists (select * from tableName) // determines whether a table exists. tableName indicates the table name.
And 1 = (select @ VERSION) // MSSQL VERSION
And 1 = (select db_
I. User table information
Ii. Conclusion
Use the query statement: Select count (1) from user; Use the explain statement to check whether the statement is indexed. the following result shows the query time of the statement.
Data Volume query
People
ChildrenIn useSqlWhentend to get into aMissDistrict, that is tooOffNote on the resultingKnotWhether the fruit is correct, but ignores the differentRealizeMethod ofBetweenPossible performance differences,ThisPerformance differences in large
It took a long time to see a friend importing data! There are actually a lot of quick methods to work out!
There are many ways to insert data into a table, but the performance varies greatly due to different methods.
---- 1. original statementDrop
Common SQL injection statement parsing bitsCN.com
SQL injection statement1. determine whether there are any injection points
'; And 1 = 1 and 1 = 2
2. Generally, the name of a table is admin adminuser user pass password ..
And 0 <> (select count (*)
People tend to fall into a misunderstanding when using SQL, that is, they are too concerned about whether the obtained results are correct, while ignoring the possible performance differences between different implementation methods, this
MySQL: database entry 5, mysql database entry
1. Storage Engine
Differences between innodb and MyIASM storage engines:1. innodb is the default storage engine of MySQL 5.5 and later versions, while MyISAM is the default storage engine before MySQL.2.
Poor SQL statements often come from inappropriate index design, incomplete join conditions, and unoptimizable where clauses. InAfter they are properly optimized, their running speed is significantly improved! I will summarize the following three
I was in the stage of solving the SQL problem and producing results. Recently, my colleagues started to pay attention to this problem because of slow SQL, I want to pay more attention to this issue today.
I sorted out some materials:
People tend to
SQL Server INDEX OPTIMIZATION
Clustered Index , The data stored in the table is stored in the order of indexes. , Higher retrieval efficiency than normal indexes , However, data is added / Modify / The deletion has a large impact.
I. unreasonable index design---- For example, a table with 620000 rows of record and rows with different indexes has the following SQL statements:---- 1. A non-cluster index is created on date.Select count (*) from record where date>'20140901' and
I. unreasonable index design---- For example, a table with 620000 rows of record and rows with different indexes has the following SQL statements:---- 1. A non-cluster index is created on date.Select count (*) from record where date>'20140901' and
I. unreasonable index design
---- For example, a table with 620000 rows of record and rows with different indexes has the following SQL statements:
---- 1. A non-cluster index is created on date.
Select count (*) from record where date>
'20140901'
How to make your SQL run faster---- People tend to fall into a misunderstanding when using SQL, that is, they are too concerned about whether the obtained results are correct and ignorePerformance differences may exist between different
Many people tend to fall into a misunderstanding when using SQL, that is, they are too concerned about whether the obtained results are correct, while ignoring the possible performance differences between different implementation methods, this
We often fall into a misunderstanding when using SQL, that is, we are too concerned about whether the obtained results are correct, while ignoring the possible performance differences between different implementation methods, this performance
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.