{"id":225881,"date":"2022-08-17T13:14:00","date_gmt":"2022-08-17T10:14:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=225881"},"modified":"2022-11-08T01:09:04","modified_gmt":"2022-11-07T22:09:04","slug":"fragmenti-tablic-mysql-i-vipravlennja-tipovih-problem","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/uk\/fragmenti-tablic-mysql-i-vipravlennja-tipovih-problem\/","title":{"rendered":"\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044c MySQL \u0456 \u0432\u0438\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044f \u0442\u0438\u043f\u043e\u0432\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c"},"content":{"rendered":"\n<p>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0456 MySQL?<\/p>\n<p>\u0422\u0430\u043a, \u0432 \u0446\u0456\u0439 \u0441\u0442\u0430\u0442\u0442\u0456 \u0457\u0445 \u0447\u0438\u043c\u0430\u043b\u043e. \u0410\u043b\u0435 \u043f\u0435\u0440\u0448 \u043d\u0456\u0436 \u043c\u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c\u043e \u0434\u043e \u0446\u044c\u043e\u0433\u043e, \u0449\u043e \u0442\u0430\u043a\u0435 MySQL? \u041f\u043e\u0447\u043d\u0435\u043c\u043e \u0437 \u0432\u0438\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f MySQL. MySQL \u2014 \u0446\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u0435\u0440\u0443\u0432\u0430\u043d\u043d\u044f \u0440\u0435\u043b\u044f\u0446\u0456\u0439\u043d\u0438\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u0438\u0445 (RDBMS) \u0456\u0437 \u0432\u0456\u0434\u043a\u0440\u0438\u0442\u0438\u043c \u0432\u0438\u0445\u0456\u0434\u043d\u0438\u043c \u043a\u043e\u0434\u043e\u043c, \u0449\u043e \u043f\u0456\u0434\u0442\u0440\u0438\u043c\u0443\u0454\u0442\u044c\u0441\u044f Oracle \u0456 \u0431\u0430\u0437\u0443\u0454\u0442\u044c\u0441\u044f \u043d\u0430 \u043c\u043e\u0432\u0456 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0432\u0430\u043d\u0438\u0445 \u0437\u0430\u043f\u0438\u0442\u0456\u0432 (SQL).<\/p>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u0438, \u044f\u043a\u0456 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u044e\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u0438\u0445 MySQL, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u044c TYPO3, MODx, Joomla, WordPress, Simple Machines Forum, phpBB, MyBB \u0456 Drupal. MySQL \u0442\u0430\u043a\u043e\u0436 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454\u0442\u044c\u0441\u044f \u043d\u0430 \u0431\u0430\u0433\u0430\u0442\u044c\u043e\u0445 \u0433\u0443\u0447\u043d\u0438\u0445, \u0432\u0435\u043b\u0438\u043a\u0438\u0445 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430\u0445, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0447\u0438 Google (\u0445\u043e\u0447\u0430 \u043d\u0435 \u0434\u043b\u044f \u043f\u043e\u0448\u0443\u043a\u0443), Facebook, Twitter, Flickr \u0456 YouTube.<\/p>\n<p>\u0406 \u043f\u0456\u0441\u043b\u044f \u0432\u0441\u044c\u043e\u0433\u043e \u0446\u044c\u043e\u0433\u043e \u0432\u0441\u0442\u0443\u043f\u0443 \u0432\u0438 \u0440\u043e\u0437\u0443\u043c\u0456\u0454\u0442\u0435, \u0449\u043e MySQL \u0431\u0456\u043b\u044c\u0448\u0438\u0439, \u043d\u0456\u0436 \u0432\u0438 \u0441\u043f\u043e\u0447\u0430\u0442\u043a\u0443 \u0434\u0443\u043c\u0430\u043b\u0438. \u0425\u0456\u0431\u0430 \u0449\u043e \u0432\u0438 \u0434\u0435\u044f\u043a\u0438\u0439 \u0447\u0430\u0441 \u043f\u0440\u0430\u0446\u044e\u0454\u0442\u0435 \u0432 \u0433\u0430\u043b\u0443\u0437\u0456. \u041e\u0434\u043d\u0430\u043a \u044f\u043a\u0449\u043e \u0432\u0438 \u043d\u043e\u0432\u0430\u0447\u043e\u043a \u0456 \u0431\u0430\u0436\u0430\u0454\u0442\u0435 \u0434\u0456\u0437\u043d\u0430\u0442\u0438\u0441\u044f \u0431\u0456\u043b\u044c\u0448\u0435 \u043f\u0440\u043e MySQL, \u043d\u0430\u0439\u043f\u0440\u043e\u0441\u0442\u0456\u0448\u0438\u0439 \u0441\u043f\u043e\u0441\u0456\u0431 \u0437\u0440\u043e\u0431\u0438\u0442\u0438 \u0446\u0435 \u2014 \u0441\u043a\u043e\u0440\u0438\u0441\u0442\u0430\u0442\u0438\u0441\u044f \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044c MySQL.<\/p>\n<h2>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044c MySQL<\/h2>\n<p><strong>\u0417\u0456\u0441\u0442\u0430\u0432\u0442\u0435 \u0440\u044f\u0434\u043e\u043a \u043d\u0430 \u043f\u043e\u0447\u0430\u0442\u043a\u0443 \u0440\u044f\u0434\u043a\u0430<\/strong><\/p>\n<p><code>SELECT 'Test' REGEXP '^The'; -- 0 SELECT 'The Test' REGEXP '^The'; -- 1<\/code><\/p>\n<p><strong>\u042f\u043a\u0449\u043e \u0456\u043c&#8217;\u044f \u043d\u0435 \u043c\u0430\u0454 \u043f\u0440\u0435\u0444\u0456\u043a\u0441\u0430 \u00abThe\u00bb, \u0434\u043e\u0434\u0430\u0439\u0442\u0435 \u0439\u043e\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\u0456\u044e\u0432\u0430\u043d\u043d\u044f \u0441\u0442\u043e\u0432\u043f\u0446\u044f \u0437 \u043e\u0434\u043d\u0456\u0454\u0457 \u0442\u0430\u0431\u043b\u0438\u0446\u0456 \u0432 \u0456\u043d\u0448\u0443<\/strong><\/p>\n<p><code>INSERT INTO [table] (<\/code><\/p>\n<p><code>) SELECT FROM [table]<\/code><\/p>\n<p><strong>\u0412\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u0432\u0441\u0456 \u043f\u0440\u043e\u0431\u0456\u043b\u0438<\/strong><\/p>\n<p><code>UPDATE [table] SET<\/code><\/p>\n<p><code>= REPLACE(, ' ', '')<\/code><\/p>\n<p><strong>(\u0446\u0435 BASH) \u0432\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u0432\u0441\u0456 \u0442\u0430\u0431\u043b\u0438\u0446\u0456 \u0432 \u0431\u0430\u0437\u0456 \u0434\u0430\u043d\u0438\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>\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u0434\u043e \u0441\u043e\u0440\u0442\u0443\u0432\u0430\u043d\u043d\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0456 \u0442\u0430 \u0432\u0441\u0456\u0445 \u0457\u0457 \u043d\u0430\u044f\u0432\u043d\u0438\u0445 \u0441\u0442\u043e\u0432\u043f\u0446\u0456\u0432<\/strong><\/p>\n<p><code>alter table [table] convert to character set utf8 collate utf8_general_ci;<\/code><\/p>\n<p><strong>\u041f\u043e\u0448\u0443\u043a \u0456 \u0437\u0430\u043c\u0456\u043d\u0430 MySQL<\/strong><\/p>\n<p><code>UPDATE files SET filepath = REPLACE(filepath,'path\/to\/search','path\/to\/replace');<\/code><\/p>\n<p><strong>\u0412\u0438\u0431\u0456\u0440 \u0432\u0438\u043f\u0430\u0434\u043a\u043e\u0432\u043e\u0433\u043e \u0440\u044f\u0434\u043a\u0430 \u0432 MySQL<\/strong><\/p>\n<p><code>SELECT column FROM table ORDER BY RAND() LIMIT 1<\/code><\/p>\n<p><strong>\u0421\u0442\u0432\u043e\u0440\u0456\u0442\u044c CSV \u0456\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>\u0417\u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044e\u0432\u0430\u043d\u0456 \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>\u0412\u0438\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044f \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0443\u0432\u0430\u043d\u043d\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u0456\u0432 \u0443 \u0434\u0430\u043d\u0438\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\u0432\u0430\u043d\u0442\u0430\u0436\u0442\u0435 CSV \u043d\u0430\u0437\u0430\u0434 \u0443 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 \u0417\u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u0434 PHP \u0443 \u0431\u0430\u0437\u0456 \u0434\u0430\u043d\u0438\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\u0443\u0432\u0430\u0442\u0438 \u0432\u0438\u043f\u0430\u0434\u043a\u043e\u0432\u0438\u0439 \u0440\u044f\u0434\u043e\u043a \u0443 MySQL<\/strong><\/p>\n<p><code>SELECT SUBSTRING(MD5(RAND()) FROM 1 FOR 6) AS randomstring<\/code><\/p>\n<p><strong>\u0420\u043e\u0437\u0440\u0430\u0445\u0443\u0432\u0430\u0442\u0438 \u0432\u0456\u043a \u0432\u0456\u0434 \u0434\u0430\u0442\u0438 \u043d\u0430\u0440\u043e\u0434\u0436\u0435\u043d\u043d\u044f<\/strong><\/p>\n<p><code>SELECT FLOOR(DATEDIFF(CURRENT_DATE(), dob) \/ 365);<\/code><\/p>\n<p><strong>\u0417\u043d\u0430\u0439\u0442\u0438 \u0442\u0430 \u0437\u0430\u043c\u0456\u043d\u0438\u0442\u0438<\/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\u0438\u0431\u0435\u0440\u0456\u0442\u044c \u043c\u0456\u0436 \u0434\u0432\u043e\u043c\u0430 \u0434\u0430\u0442\u0430\u043c\u0438<\/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\u0435 \u043a\u043e\u043f\u0456\u044e\u0432\u0430\u043d\u043d\u044f \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 MySQL \u0443 \u0444\u0430\u0439\u043b SQL \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\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>\u044f\u043a \u0440\u043e\u0437\u0440\u0430\u0445\u0443\u0432\u0430\u0442\u0438 \u043e\u0441\u0442\u0430\u043d\u043d\u0456 7 \u0434\u043d\u0456\u0432<\/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>\u0417\u0430\u043c\u0456\u043d\u0430 Mysql<\/strong><\/p>\n<p>`# \u0417\u0430\u043c\u0456\u043d\u0438\u0442\u0438 \u0440\u044f\u0434\u043e\u043a \u0443 \u0432\u0441\u0456\u0445 \u0437\u0430\u043f\u0438\u0441\u0430\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0456<br \/>\nUPDATE table_name SET column_name = REPLACE( column_name, &#8216;\/dev&#8217;, &quot; );<\/p>\n<p>SELECT REPLACE( column_name, &#8216;\/dev&#8217;, &#8220;) FROM table_name;`<\/p>\n<p><strong>\u041f\u0435\u0440\u0435\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f \u0447\u0430\u0441\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u044f\u0441\u0443 \u043d\u0430 \u043c\u0456\u0441\u0446\u0435\u0432\u0438\u0439<\/strong><\/p>\n<p><code>SELECT CONVERT_TZ(mydatefield,'US\/Pacific','CET') FROM mytable;<\/code><\/p>\n<p><strong>\u041f\u043e\u0448\u0443\u043a \u0456 \u0437\u0430\u043c\u0456\u043d\u0430 \u0432 \u043a\u0456\u043b\u044c\u043a\u043e\u0445 \u0440\u044f\u0434\u043a\u0430\u0445 \u0443 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>\u042f\u043a \u0437\u0431\u0435\u0440\u0435\u0433\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0438 \u0437 MySQL \u0443 \u0437\u043e\u0432\u043d\u0456\u0448\u043d\u0456\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\u0442\u0435 \u0430\u0431\u043e \u043e\u043d\u043e\u0432\u0456\u0442\u044c, \u044f\u043a\u0449\u043e \u0443\u043d\u0456\u043a\u0430\u043b\u044c\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 \u0443\u0436\u0435 \u0456\u0441\u043d\u0443\u0454<\/strong><\/p>\n<p><code>INSERT INTO `tableName` VALUES (?,?,?,'-1',?,'0') ON DUPLICATE KEY UPDATE `id` = ?, `foo` = ?, `bar` = ?<\/code><\/p>\n<p><strong>mySQL \u2013 \u043a\u043e\u043c\u0430\u043d\u0434\u0438 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043f\u0456\u044e\u0432\u0430\u043d\u043d\u044f \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\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>\u0406\u043c\u043f\u043e\u0440\u0442 MySql<\/strong><\/p>\n<p><code>mysql -u [username] -p [dbname] &lt; [filename].sql<\/code><\/p>\n<p><strong>\u0437\u043d\u0430\u0439\u0442\u0438 \u0434\u0443\u0431\u043b\u0456\u043a\u0430\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u0456\u0432<\/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>\u041f\u043e\u0448\u0443\u043a \u0456 \u0437\u0430\u043c\u0456\u043d\u0430 MySQL<\/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>\u0417\u043c\u0456\u043d\u0456\u0442\u044c \u0448\u043b\u044f\u0445 \u0434\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443 \u0444\u0430\u0439\u043b\u0456\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>\u0417\u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0456 \u0442\u0430\u0431\u043b\u0438\u0446\u0456 \u0432 \u0431\u0430\u0437\u0456 \u0434\u0430\u043d\u0438\u0445 MySQL, \u0449\u043e \u043c\u0456\u0441\u0442\u044f\u0442\u044c \u043f\u0435\u0432\u043d\u0456 \u0456\u043c\u0435\u043d\u0430 \u0441\u0442\u043e\u0432\u043f\u0446\u0456\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>\u0417\u043d\u0430\u0439\u0434\u0456\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f, \u044f\u043a\u0456 \u0437\u0443\u0441\u0442\u0440\u0456\u0447\u0430\u044e\u0442\u044c\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0456 \u0440\u0456\u0432\u043d\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437<\/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\u0448\u0443\u043a\u0443 \u043d\u0435\u0434\u0456\u0439\u0441\u043d\u0438\u0445 \u0430\u0434\u0440\u0435\u0441 \u0435\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0457 \u043f\u043e\u0448\u0442\u0438<\/strong><\/p>\n<p><code>SELECT * FROM people WHERE email NOT LIKE '%_@__%.__%'<\/code><\/p>\n<p><strong>\u0420\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a \u0432\u0456\u043a\u0443 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>\u041b\u0456\u0432\u0456 \u043e\u0431\u2019\u0454\u0434\u043d\u0430\u043d\u043d\u044f \u0434\u043b\u044f \u0437\u0432\u2019\u044f\u0437\u0443\u0432\u0430\u043d\u043d\u044f \u0442\u0440\u044c\u043e\u0445 \u0430\u0431\u043e \u0431\u0456\u043b\u044c\u0448\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044c<\/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 \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u0430\u0454 \u0441\u043f\u0438\u0441\u043a\u0443, \u0440\u043e\u0437\u0434\u0456\u043b\u0435\u043d\u043e\u043c\u0443 \u043a\u043e\u043c\u0430\u043c\u0438<\/strong><\/p>\n<p><code>WHERE id REGEXP '(,|^){$this-&gt;id}(,|$)'<\/code><\/p>\n<p><strong>\u041e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 \u0432\u0438\u043f\u0430\u0434\u043a\u043e\u0432\u0438\u0439 \u0437\u0430\u043f\u0438\u0441 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0456 \u0432\u0430\u0433\u0438<\/strong><\/p>\n<p><code>SELECT * FROM Table ORDER BY Rand() * (1 \/ Weight<\/code><\/p>\n<p>\u041c\u0438 \u0441\u043f\u043e\u0434\u0456\u0432\u0430\u0454\u043c\u043e\u0441\u044f, \u0449\u043e \u0446\u0456 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044c MySQL \u2013 \u0446\u0435 \u0442\u0435, \u0449\u043e \u0432\u0438 \u0448\u0443\u043a\u0430\u043b\u0438. \u041c\u0438 \u043e\u043d\u043e\u0432\u0438\u043c\u043e \u0446\u044e \u0441\u0442\u0430\u0442\u0442\u044e \u0456\u043d\u0448\u0438\u043c\u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u043c\u0438 MySQL, \u044f\u043a\u0456 \u043c\u0438 \u0437\u0443\u0441\u0442\u0440\u0456\u043d\u0435\u043c\u043e \u0432 \u043c\u0430\u0439\u0431\u0443\u0442\u043d\u044c\u043e\u043c\u0443, \u0442\u043e\u043c\u0443 \u043e\u0431\u043e\u0432\u2019\u044f\u0437\u043a\u043e\u0432\u043e \u0434\u043e\u0434\u0430\u0439\u0442\u0435 \u0457\u0457 \u0432 \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0438.<\/p>\n<p>\u042f\u043a\u0449\u043e \u0432\u0430\u043c \u0441\u043f\u043e\u0434\u043e\u0431\u0430\u043b\u043e\u0441\u044f \u0447\u0438\u0442\u0430\u0442\u0438 \u0446\u044e \u0441\u0442\u0430\u0442\u0442\u044e \u043f\u0440\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044c MySQL, \u0432\u0438 \u0442\u0430\u043a\u043e\u0436 \u043f\u043e\u0432\u0438\u043d\u043d\u0456 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u0438 \u0446\u0456:<\/p>\n<ul>\n<li><a href=\"https:\/\/wordpress.mediadoma.com\/uk\/stvorennja-crud-sistemi-v-wordpress-wpdatatables-tables-plugin\/\" title=\"\u0421\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0438 CRUD \u0432 WordPress (2018)\" >\u0421\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0438 CRUD \u0432 WordPress (2018)<\/a><\/li>\n<li><a href=\"https:\/\/wordpress.mediadoma.com\/uk\/12-porad-shhodo-stvorennja-uspishnoi-temi-abo-plagina-wordpress\/\" title=\"12 \u043f\u043e\u0440\u0430\u0434 \u0449\u043e\u0434\u043e \u0441\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f \u0443\u0441\u043f\u0456\u0448\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043c\u0456\u0443\u043c-\u043f\u043b\u0430\u0433\u0456\u043d\u0430 \u0430\u0431\u043e \u0442\u0435\u043c\u0438 WordPress\" >12 \u043f\u043e\u0440\u0430\u0434 \u0449\u043e\u0434\u043e \u0441\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f \u0443\u0441\u043f\u0456\u0448\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043c\u0456\u0443\u043c-\u043f\u043b\u0430\u0433\u0456\u043d\u0430 \u0430\u0431\u043e \u0442\u0435\u043c\u0438 WordPress<\/a><\/li>\n<li><a href=\"https:\/\/wpdatatables.com\/how-to-host-a-website\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u042f\u043a \u0440\u043e\u0437\u043c\u0456\u0441\u0442\u0438\u0442\u0438 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442: \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u043d\u044f \u0432\u0441\u0456\u0445 \u043a\u0440\u043e\u043a\u0456\u0432<\/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\u0456\u0437\u0430\u0446\u0456\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0456 WordPress WP_OPTIONS<\/a><\/li>\n<\/ul>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0414\u0436\u0435\u0440\u0435\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0443:  <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\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0456 MySQL? \u0422\u0430\u043a, \u0432 \u0446\u0456\u0439 \u0441\u0442\u0430\u0442\u0442\u0456 \u0457\u0445 \u0447\u0438\u043c\u0430\u043b\u043e. \u0410\u043b\u0435 \u043f\u0435\u0440\u0448 \u043d\u0456\u0436 \u043c\u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c\u043e \u0434\u043e \u0446\u044c\u043e\u0433\u043e, \u0449\u043e \u0442\u0430\u043a\u0435 MySQL? \u041f\u043e\u0447\u043d\u0435\u043c\u043e \u0437 \u0432\u0438\u0437\u043d\u0430\u0447\u0435\u043d\u043d\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":[869,839,849],"tags":[1174],"class_list":["post-225881","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-10","category-kerivnytstvo-dlia-pochatkivtsiv","category-pidruchnyky","tag-affiai-uk"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts\/225881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/comments?post=225881"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts\/225881\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/media\/206960"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/media?parent=225881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/categories?post=225881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/tags?post=225881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}