{"id":217802,"date":"2022-08-17T13:32:00","date_gmt":"2022-08-17T10:32:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=217802"},"modified":"2022-08-22T10:56:24","modified_gmt":"2022-08-22T07:56:24","slug":"fragmenty-tablic-mysql-i-ispravlenija-rasprostranennyh-problem","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/ru\/fragmenty-tablic-mysql-i-ispravlenija-rasprostranennyh-problem\/","title":{"rendered":"\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0442\u0430\u0431\u043b\u0438\u0446 MySQL \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c"},"content":{"rendered":"\n<p>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b MySQL?<\/p>\n<p>\u0414\u0430, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0445 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e. \u041d\u043e \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u044d\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 MySQL? \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f MySQL. MySQL \u2014 \u044d\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u0430\u044f Oracle \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 (RDBMS) \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (SQL).<\/p>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 MySQL, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 TYPO3, MODx, Joomla, WordPress, Simple Machines Forum, phpBB, MyBB \u0438 Drupal. MySQL \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0445 \u0432\u044b\u0441\u043e\u043a\u043e\u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0445 \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430\u0445, \u0432\u043a\u043b\u044e\u0447\u0430\u044f Google (\u0445\u043e\u0442\u044f \u0438 \u043d\u0435 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430), Facebook, Twitter, Flickr \u0438 YouTube.<\/p>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u0432\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435, \u0447\u0442\u043e MySQL \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0432\u044b \u0434\u0443\u043c\u0430\u043b\u0438 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e. \u0415\u0441\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u043d\u0435 \u0431\u044b\u043b\u0438 \u0432 \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u043e\u0432\u0438\u0447\u043e\u043a \u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u043e MySQL, \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446 MySQL.<\/p>\n<h2>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b MySQL<\/h2>\n<p><strong>\u0421\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438<\/strong><\/p>\n<p><code>SELECT 'Test' REGEXP '^The'; -- 0 SELECT 'The Test' REGEXP '^The'; -- 1<\/code><\/p>\n<p><strong>\u0415\u0441\u043b\u0438 \u0438\u043c\u044f \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 \u00abThe\u00bb, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0435\u0433\u043e<\/strong><\/p>\n<p><code>UPDATE [table] SET Name = CONCAT('The ', TRIM(Name)) WHERE Name NOT REGEXP '^The'<\/code><\/p>\n<p><strong>\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0434\u0440\u0443\u0433\u0443\u044e<\/strong><\/p>\n<p><code>INSERT INTO [table] (<\/code><\/p>\n<p><code>) SELECT FROM [table]<\/code><\/p>\n<p><strong>\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b<\/strong><\/p>\n<p><code>UPDATE [table] SET<\/code><\/p>\n<p><code>= REPLACE(, ' ', '')<\/code><\/p>\n<p><strong>(\u044d\u0442\u043e BASH) \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<p><code>mysqldump -u[USERNAME] -p[PASSWORD] --add-drop-table --no-data [DATABASE] | grep ^DROP | mysql -u[USERNAME] -p[PASSWORD] [DATABASE]<\/code><\/p>\n<p><strong>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0432\u0441\u0435\u0445 \u0435\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432<\/strong><\/p>\n<p><code>alter table [table] convert to character set utf8 collate utf8_general_ci;<\/code><\/p>\n<p><strong>MySQL \u043d\u0430\u0439\u0442\u0438 \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c<\/strong><\/p>\n<p><code>UPDATE files SET filepath = REPLACE(filepath,'path\/to\/search','path\/to\/replace');<\/code><\/p>\n<p><strong>\u0412\u044b\u0431\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 MySQL<\/strong><\/p>\n<p><code>SELECT column FROM table ORDER BY RAND() LIMIT 1<\/code><\/p>\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u0442\u044c CSV \u0438\u0437 MySQL<\/strong><\/p>\n<p><code>SELECT a,b,c FROM my_table INTO OUTFILE '\/ca.csv' FIELDS TERMINATED BY ',' LINES TERMINATED BY 'n';<\/code><\/p>\n<p><strong>\u041d\u0430\u0439\u0442\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u0438<\/strong><\/p>\n<p><code>SELECT id, COUNT(*) as n FROM my_table GROUP BY id HAVING n &gt;1;<\/code><\/p>\n<p><strong>\u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0434\u0430\u043d\u043d\u044b\u0445 MySQL<\/strong><\/p>\n<p><code>UPDATE table SET column=CONVERT(CONVERT(CONVERT(column USING latin1) USING binary) using utf8);<\/code><\/p>\n<p><strong>\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 CSV \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 mySQL<\/strong><\/p>\n<p><code>LOAD DATA local INFILE 'unique.csv' INTO TABLE tablename FIELDS TERMINATED BY ',' LINES TERMINATED BY 'n' (col1, col2, col3)<\/code><\/p>\n<p><strong>Drupal 6.x \u041d\u0430\u0439\u0442\u0438 PHP-\u043a\u043e\u0434 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<p><code>select nid, vid from node_revisions where format in (select format from filters where module = 'php' and delta = 0); select cid, nid from comments where format in (select format from filters where module = 'php' and delta = 0); select bid, info from boxes where format in (select format from filters where module = 'php' and delta = 0);<\/code><\/p>\n<p><strong>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 MySQL<\/strong><\/p>\n<p><code>SELECT SUBSTRING(MD5(RAND()) FROM 1 FOR 6) AS randomstring<\/code><\/p>\n<p><strong>\u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u043e\u0437\u0440\u0430\u0441\u0442 \u043f\u043e \u0434\u0430\u0442\u0435 \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f<\/strong><\/p>\n<p><code>SELECT FLOOR(DATEDIFF(CURRENT_DATE(), dob) \/ 365);<\/code><\/p>\n<p><strong>\u041d\u0430\u0439\u0442\u0438 \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c<\/strong><\/p>\n<p><code>UPDATE table_name SET column_name = REPLACE(column_name, 'http:\/\/oldcontent.com', 'http:\/\/newcontent.com');<\/code><\/p>\n<p><strong>\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0434\u0430\u0442<\/strong><\/p>\n<p><code>SELECT * FROM files LEFT JOIN (dates) ON files.uploaded_id = dates.id WHERE date BETWEEN '2009-01-01' AND '2009-12-31'<\/code><\/p>\n<p><strong>\u0420\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 MySQL \u0432 \u0444\u0430\u0439\u043b SQL \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e mysqldump<\/strong><\/p>\n<p><code>mysqldump --user=username --password=password --opt --add-drop-database --databases databasename &gt; ~\/path\/to\/file.sql<\/code><\/p>\n<p><strong>\u043a\u0430\u043a \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 7 \u0434\u043d\u0435\u0439<\/strong><\/p>\n<p><code>WHERE mydatefld &gt;= DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY)<\/code><\/p>\n<p><strong>\u0434\u0430\u043c\u043f mysql<\/strong><\/p>\n<p><code>mysqldump -u [username] -p [password] [databasename] &gt; [backupfile.sql]<\/code><\/p>\n<p><strong>Mysql \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c<\/strong><\/p>\n<p>`# \u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u043e \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<br \/>\nUPDATE table_name SET column_name = REPLACE( column_name, &#8216;\/dev&#8217;, &quot; );<\/p>\n<p>\u0412\u042b\u0411\u0415\u0420\u0418\u0422\u0415 \u0417\u0410\u041c\u0415\u041d\u0423(\u0438\u043c\u044f_\u0441\u0442\u043e\u043b\u0431\u0446\u0430, &#8216;\/dev&#8217;, &quot;&quot;) \u0418\u0417 \u0438\u043c\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u044b;`<\/p>\n<p><strong>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u043f\u043e\u044f\u0441 \u0432 \u043c\u0435\u0441\u0442\u043d\u044b\u0439<\/strong><\/p>\n<p><code>SELECT CONVERT_TZ(mydatefield,'US\/Pacific','CET') FROM mytable;<\/code><\/p>\n<p><strong>\u041f\u043e\u0438\u0441\u043a \u0438 \u0437\u0430\u043c\u0435\u043d\u0430 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0432 SQL<\/strong><\/p>\n<p><code>UPDATE wp_posts SET post_content = REPLACE(post_content, 'staging.server.com', 'www.productionserver.com');<\/code><\/p>\n<p><strong>\u041a\u0430\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u0437 MySQL \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0444\u0430\u0439\u043b<\/strong><\/p>\n<p><code>echo \"SELECT columns FROM table_name WHERE whatever='something'\" | \/path\/to\/mysql -uUSERNAME -pPASSWORD DATABASENAME &gt; \/tmp\/outfile.txt;<\/code><\/p>\n<p><strong>\u0412\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u0435, \u0435\u0441\u043b\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442<\/strong><\/p>\n<p><code>INSERT INTO `tableName` VALUES (?,?,?,'-1',?,'0') ON DUPLICATE KEY UPDATE `id` = ?, `foo` = ?, `bar` = ?<\/code><\/p>\n<p><strong>mySQL \u2014 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<p><code>-- dump mySQL database to file: VAR=$(date +\u00c3\u00a2\u00ef\u00bf\u00bd\u00ef\u00bf\u00bd%y-%m-%d\u00c3\u00a2\u00ef\u00bf\u00bd\u00ef\u00bf\u00bd); mysqldump -v -uUSERNAME -pPASSWORD -hlocalhost DATABASENAME &gt; \/BACKUPDIR\/$VAR-DATABASENAME.sql ;<\/code><\/p>\n<p><code>-- dump mySQL database to file and then move it: VAR=$(date +\u00c3\u00a2\u00ef\u00bf\u00bd\u00ef\u00bf\u00bd%y-%m-%d\u00c3\u00a2\u00ef\u00bf\u00bd\u00ef\u00bf\u00bd); mysqldump -v -uUSERNAME -pPASSWORD -hlocalhost DATABASENAME &gt; \/BACKUPDIR\/$VAR-DATABASENAME.sql ; mv \/BACKUPDIR\/DATABASENAME.sql \/OTHERBACKUPDIR\/$VAR-DATABASENAME.sql ;<\/code><\/p>\n<p><strong>\u0438\u043c\u043f\u043e\u0440\u0442 MySql<\/strong><\/p>\n<p><code>mysql -u [username] -p [dbname] &lt; [filename].sql<\/code><\/p>\n<p><strong>\u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u0438<\/strong><\/p>\n<p><code>select address, count(address) as cnt from mailing_list group by address having cnt &gt; 1 order by cnt;<\/code><\/p>\n<p><strong>MySQL \u043d\u0430\u0439\u0442\u0438 \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c<\/strong><\/p>\n<p><code>update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, 'find this string', 'replace found string with this string');<\/code><\/p>\n<p><strong>\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0443\u0442\u044c \u043a \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443 \u0444\u0430\u0439\u043b\u043e\u0432 Drupal<\/strong><\/p>\n<p><code>UPDATE FILES SET filepath = REPLACE(filepath, 'sites\/default\/files\/old\/','sites\/default\/files\/new\/');<\/code><\/p>\n<p><strong>\u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 MySQL, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432<\/strong><\/p>\n<p><code>SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('columnA','ColumnB') AND TABLE_SCHEMA='YourDatabase';<\/code><\/p>\n<p><strong>\u041d\u0430\u0439\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435<\/strong><\/p>\n<p><code>SELECT email FROM users GROUP BY email HAVING (COUNT(email) = 1 )<\/code><\/p>\n<p><strong>\u0421\u043a\u0440\u0438\u043f\u0442 MySql \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0435\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b<\/strong><\/p>\n<p><code>SELECT * FROM people WHERE email NOT LIKE '%_@__%.__%'<\/code><\/p>\n<p><strong>\u0420\u0430\u0441\u0447\u0435\u0442 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430 MySQL<\/strong><\/p>\n<p><code>DATE_FORMAT(NOW(), '%Y') - DATE_FORMAT(DOB, '%Y') - (DATE_FORMAT(NOW(), '00-%m-%d') &lt; DATE_FORMAT(DOB, '00-%m-%d')) &gt;= 65<\/code><\/p>\n<p><strong>Left Joins \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u044f \u0442\u0440\u0435\u0445 \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0442\u0430\u0431\u043b\u0438\u0446<\/strong><\/p>\n<p><code>select * from (bdg left join res on bdg.bid = res.bid) left join dom on res.rid = dom.rid where dom.rid is NULL;<\/code><\/p>\n<p><strong>MySQL REGEX \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u0438\u0441\u043a\u0443 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f\u043c\u0438-\u0437\u0430\u043f\u044f\u0442\u044b\u043c\u0438<\/strong><\/p>\n<p><code>WHERE id REGEXP '(,|^){$this-&gt;id}(,|$)'<\/code><\/p>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0432\u0435\u0441\u0430<\/strong><\/p>\n<p><code>SELECT * FROM Table ORDER BY Rand() * (1 \/ Weight<\/code><\/p>\n<p>\u041c\u044b \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0442\u0430\u0431\u043b\u0438\u0446 MySQL \u2014 \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0432\u044b \u0438\u0441\u043a\u0430\u043b\u0438. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u043c\u0438 MySQL, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0435\u043c\u0441\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0432 \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0447\u0438\u0442\u0430\u0442\u044c \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 MySQL, \u0432\u044b \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u044d\u0442\u0438:<\/p>\n<ul>\n<li><a href=\"https:\/\/wordpress.mediadoma.com\/ru\/sozdanie-crud-sistemy-v-wordpress-plagin-tablic-wpdatatables\/\" title=\"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 CRUD-\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 WordPress (2018)\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 CRUD-\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 WordPress (2018)<\/a><\/li>\n<li><a href=\"https:\/\/wordpress.mediadoma.com\/ru\/12-sovetov-po-sozdaniju-uspeshnoj-temy-ili-plagina-wordpress\/\" title=\"12 \u0441\u043e\u0432\u0435\u0442\u043e\u0432 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043c\u0438\u0443\u043c-\u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0438\u043b\u0438 \u0442\u0435\u043c\u044b WordPress\">12 \u0441\u043e\u0432\u0435\u0442\u043e\u0432 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043c\u0438\u0443\u043c-\u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0438\u043b\u0438 \u0442\u0435\u043c\u044b WordPress<\/a><\/li>\n<li><a href=\"https:\/\/wpdatatables.com\/how-to-host-a-website\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u041a\u0430\u043a \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0435\u0431-\u0441\u0430\u0439\u0442: \u0432\u0441\u0435 \u0448\u0430\u0433\u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u044b<\/a><\/li>\n<li><a href=\"https:\/\/websensepro.com\/blog\/improve-database-performance-by-cleaning-wp_options-table\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b WordPress WP_OPTIONS<\/a><\/li>\n<\/ul>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0437\u0430\u043f\u0438\u0441\u0438:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/wpdatatables.com\" class=\"external external_icon\">wpdatatables.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b MySQL? \u0414\u0430, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0445 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e. \u041d\u043e \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u044d\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 MySQL? \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f MySQL.<\/p>\n","protected":false},"author":1,"featured_media":206960,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[870,618,850],"tags":[1171],"class_list":["post-217802","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-ru","category-rukovodstvo-dlja-nachinajushhih","category-uchebniki-ru","tag-affiai-ru"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/217802","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/comments?post=217802"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/217802\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media\/206960"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media?parent=217802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/categories?post=217802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/tags?post=217802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}