SQL Statement Learning

Source: Internet
Author: User

SQL Statement LearningOne, select playerID,count (playerID)As num from operatelog_$i where playerID > 0 and Rootid = and typeId = 12156 and Actiontime >= 1381509000000 and Actiontime <= 1381511220000 GROUP by playerID havecount (*) > 2; This--> can calculate the number of records for multiple records This-You can calculate the number of playerID that have more than one record  Tuesday, January 14, 2014 Sql,where 1 = 1 and 1 = 0 Magicalwhere 1 = 1:in order to give some uncertainty whether you can add a where statement plus securitywhere 1 = 0:is used primarily to create a new table, and the structure of the new table is the same as the structure of the queried table. The following SQL statement: CREATE TABLE newtable as SELECT * from Oldtable where1=0; SQL statement to add an If statement:,SELECT * FROM Configgoods where 1=1#if (Type > 0) {type = 4}; SQL Date increase or decrease select * FROM table where date < Date_add (today (), INTERVAL-7 Day); Monday, May 5, 2014 the table structure of MySQL-----InnoDBAndMyISAM1. InnoDB does not support FulltextThe index is established 2. InnoDB when deleting a table no new tables will be built, but deletes 3 in a row. InnoDB's row locks are not absolute, at an indeterminate time (where xx like '%xx ') locks the entire table 4. Establish a good index, InnoDB can be as fast as 5 faster than MyISAM. InnoDB row count is not saved, when executing the COUNT (*) statement, InnoDB needs to scan the entire table to calculate the number of rows, MyISAM only need to read the number of rows, but when the where condition is added, the two are the same speed Note: If you set Innodb_flush_log_at_trx_commit to 1, each insert will be automatically committed (refresh the log), performance will drop sharply, should be set to 0 Summary:InnoDB itself a lot of good features, such as transaction support, stored procedures, views, row-level locking and so on, in the case of a lot of concurrency, I believe InnoDB performance is certainly much stronger than MyISAM Tuesday, May 13, 2014 MySQLConversion Time FunctionFrom_unixtime (eventtime, '%y-%m-%d%h:%m:%s ')

SQL Statement Learning

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.