{"id":1163,"date":"2012-09-16T17:27:28","date_gmt":"2012-09-17T00:27:28","guid":{"rendered":"http:\/\/www.virendrachandak.com\/techtalk\/\/?p=1163"},"modified":"2013-10-03T11:13:21","modified_gmt":"2013-10-03T18:13:21","slug":"mysql-ordering-results-by-specific-field-values","status":"publish","type":"post","link":"https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/","title":{"rendered":"MySQL ordering results by specific field values"},"content":{"rendered":"<div>In MySQL we can sort the results in ascending or descending order very easily by using the <strong>ORDER BY<\/strong> clause. However, there are times when you want to sort the results in a specific order which cannot be done using the ASC or DSC. <strong>FIELD()<\/strong> of MySQL ORDER BY clause can be used to sort the results in a specific order.<\/div>\n<div>For this post I will use my <a href=\"http:\/\/www.virendrachandak.com\/techtalk\/\/sample-mysql-table\/\" title=\"Sample MySQL table\" target=\"_blank\">example MySQL table and data<\/a>. This is just a sample table with sample data, used to represent what I need. So, in this table I have different species of pets and I need to get a list of all pets in the order dogs, cat, snake and bird. I cannot use the MySQL ORDER BY clause to fetch the results in this order. By using the FIELD() function of the MySQL ORDER BY clause I can get the results in the order I need. Here is the query I can use.<\/div>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT name, species FROM `pet`\r\nORDER BY FIELD(species, 'dog','cat','snake','bird'), name ASC\r\n<\/pre>\n<p><!--more--><br \/>\nThis query would return me the results ordered by the species in the order I need and then sort it by name. Here is the result:<\/p>\n<div>\n<table>\n<tbody>\n<tr>\n<th>name<\/th>\n<th>species<\/th>\n<\/tr>\n<tr>\n<td>Bowser<\/td>\n<td>dog<\/td>\n<\/tr>\n<tr>\n<td>Buffy<\/td>\n<td>dog<\/td>\n<\/tr>\n<tr>\n<td>Fang<\/td>\n<td>dog<\/td>\n<\/tr>\n<tr>\n<td>Claws<\/td>\n<td>cat<\/td>\n<\/tr>\n<tr>\n<td>Fluffy<\/td>\n<td>cat<\/td>\n<\/tr>\n<tr>\n<td>Slim<\/td>\n<td>snake<\/td>\n<\/tr>\n<tr>\n<td>Chirpy<\/td>\n<td>bird<\/td>\n<\/tr>\n<tr>\n<td>Whistler<\/td>\n<td>bird<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>The above solution works fine as along as there are no other values in the table for species apart from what specified in the FIELD function. In case there are other values and you need them to appear last in the list then we will need to change the query. Using the same table, consider that we want to sort the results by dog and cat first and anything else after then we can use the following query:<\/div>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT name, species FROM `pet` \r\nORDER BY FIELD(species, 'cat','dog') DESC , name ASC\r\n<\/pre>\n<div>\nThis will give us the following results:<\/p>\n<table>\n<tbody>\n<tr>\n<th>name<\/th>\n<th>species<\/th>\n<\/tr>\n<tr>\n<td>Bowser<\/td>\n<td>dog<\/td>\n<\/tr>\n<tr>\n<td>Buffy<\/td>\n<td>dog<\/td>\n<\/tr>\n<tr>\n<td>Fang<\/td>\n<td>dog<\/td>\n<\/tr>\n<tr>\n<td>Claws<\/td>\n<td>cat<\/td>\n<\/tr>\n<tr>\n<td>Fluffy<\/td>\n<td>cat<\/td>\n<\/tr>\n<tr>\n<td>Chirpy<\/td>\n<td>bird<\/td>\n<\/tr>\n<tr>\n<td>Slim<\/td>\n<td>snake<\/td>\n<\/tr>\n<tr>\n<td>Whistler<\/td>\n<td>bird<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\nNotice that the results are sorted by dog and cat, but not by any other species. If we need to have the other results also in group we can use the following query:<\/div>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT name, species FROM `pet` \r\nORDER BY FIELD(species, 'cat','dog') DESC, species ASC, name ASC\r\n<\/pre>\n<div>\nNow this query returns us the following results:<\/p>\n<table>\n<tbody>\n<tr>\n<th>name<\/th>\n<th>species<\/th>\n<\/tr>\n<tr>\n<td>Bowser<\/td>\n<td>dog<\/td>\n<\/tr>\n<tr>\n<td>Buffy<\/td>\n<td>dog<\/td>\n<\/tr>\n<tr>\n<td>Fang<\/td>\n<td>dog<\/td>\n<\/tr>\n<tr>\n<td>Claws<\/td>\n<td>cat<\/td>\n<\/tr>\n<tr>\n<td>Fluffy<\/td>\n<td>cat<\/td>\n<\/tr>\n<tr>\n<td>Chirpy<\/td>\n<td>bird<\/td>\n<\/tr>\n<tr>\n<td>Whistler<\/td>\n<td>bird<\/td>\n<\/tr>\n<tr>\n<td>Slim<\/td>\n<td>snake<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div><span style=\"text-decoration:underline;\">Note<\/span>: I searched the MySQL documentation but I am unable to find the proper documentation for this function. However, I have tried this on MySQL 5.0, 5.1, 5.5 and it works in all of them.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In MySQL we can sort the results in ascending or descending order very easily by using the ORDER BY clause. However, there are times when you want to sort the results in a specific order which cannot be done using the ASC or DSC. FIELD() of MySQL ORDER BY clause can be used to sort [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[48],"tags":[103,104,105],"class_list":["post-1163","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-mysql-order-by","tag-mysql-results-order","tag-order-by-field"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL ordering results by specific field values - Virendra&#039;s TechTalk<\/title>\n<meta name=\"description\" content=\"In MySQL we can sort the results in ascending or descending order very easily by using the ORDER BY clause. However, there are times when you want to sort\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL ordering results by specific field values - Virendra&#039;s TechTalk\" \/>\n<meta property=\"og:description\" content=\"In MySQL we can sort the results in ascending or descending order very easily by using the ORDER BY clause. However, there are times when you want to sort\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/\" \/>\n<meta property=\"og:site_name\" content=\"Virendra&#039;s TechTalk\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:published_time\" content=\"2012-09-17T00:27:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-10-03T18:13:21+00:00\" \/>\n<meta name=\"author\" content=\"Virendra Chandak\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:site\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virendra Chandak\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/mysql-ordering-results-by-specific-field-values\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/mysql-ordering-results-by-specific-field-values\\\/\"},\"author\":{\"name\":\"Virendra Chandak\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"headline\":\"MySQL ordering results by specific field values\",\"datePublished\":\"2012-09-17T00:27:28+00:00\",\"dateModified\":\"2013-10-03T18:13:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/mysql-ordering-results-by-specific-field-values\\\/\"},\"wordCount\":461,\"commentCount\":9,\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"keywords\":[\"MySQL order by\",\"MySQL results order\",\"Order By Field\"],\"articleSection\":[\"MySQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/mysql-ordering-results-by-specific-field-values\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/mysql-ordering-results-by-specific-field-values\\\/\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/mysql-ordering-results-by-specific-field-values\\\/\",\"name\":\"MySQL ordering results by specific field values - Virendra's TechTalk\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\"},\"datePublished\":\"2012-09-17T00:27:28+00:00\",\"dateModified\":\"2013-10-03T18:13:21+00:00\",\"description\":\"In MySQL we can sort the results in ascending or descending order very easily by using the ORDER BY clause. However, there are times when you want to sort\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/mysql-ordering-results-by-specific-field-values\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/mysql-ordering-results-by-specific-field-values\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/mysql-ordering-results-by-specific-field-values\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"TechTalk\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/category\\\/mysql\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"MySQL ordering results by specific field values\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\",\"name\":\"Virendra's TechTalk\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\",\"name\":\"Virendra Chandak\",\"logo\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.virendrachandak.com\",\"https:\\\/\\\/www.facebook.com\\\/virendrachandak\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/virendrachandak\\\/\",\"https:\\\/\\\/x.com\\\/virendrachandak\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL ordering results by specific field values - Virendra's TechTalk","description":"In MySQL we can sort the results in ascending or descending order very easily by using the ORDER BY clause. However, there are times when you want to sort","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/","og_locale":"en_US","og_type":"article","og_title":"MySQL ordering results by specific field values - Virendra's TechTalk","og_description":"In MySQL we can sort the results in ascending or descending order very easily by using the ORDER BY clause. However, there are times when you want to sort","og_url":"https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/","og_site_name":"Virendra&#039;s TechTalk","article_publisher":"https:\/\/www.facebook.com\/virendrachandak","article_author":"https:\/\/www.facebook.com\/virendrachandak","article_published_time":"2012-09-17T00:27:28+00:00","article_modified_time":"2013-10-03T18:13:21+00:00","author":"Virendra Chandak","twitter_card":"summary_large_image","twitter_creator":"@virendrachandak","twitter_site":"@virendrachandak","twitter_misc":{"Written by":"Virendra Chandak","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/#article","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/"},"author":{"name":"Virendra Chandak","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"headline":"MySQL ordering results by specific field values","datePublished":"2012-09-17T00:27:28+00:00","dateModified":"2013-10-03T18:13:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/"},"wordCount":461,"commentCount":9,"publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"keywords":["MySQL order by","MySQL results order","Order By Field"],"articleSection":["MySQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/","url":"https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/","name":"MySQL ordering results by specific field values - Virendra's TechTalk","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website"},"datePublished":"2012-09-17T00:27:28+00:00","dateModified":"2013-10-03T18:13:21+00:00","description":"In MySQL we can sort the results in ascending or descending order very easily by using the ORDER BY clause. However, there are times when you want to sort","breadcrumb":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.virendrachandak.com\/techtalk\/mysql-ordering-results-by-specific-field-values\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"TechTalk","item":"https:\/\/www.virendrachandak.com\/techtalk\/"},{"@type":"ListItem","position":2,"name":"MySQL","item":"https:\/\/www.virendrachandak.com\/techtalk\/category\/mysql\/"},{"@type":"ListItem","position":3,"name":"MySQL ordering results by specific field values"}]},{"@type":"WebSite","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website","url":"https:\/\/www.virendrachandak.com\/techtalk\/","name":"Virendra's TechTalk","description":"","publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.virendrachandak.com\/techtalk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17","name":"Virendra Chandak","logo":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.virendrachandak.com","https:\/\/www.facebook.com\/virendrachandak","https:\/\/www.linkedin.com\/in\/virendrachandak\/","https:\/\/x.com\/virendrachandak"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2vTtQ-iL","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1239,"url":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-get-size-of-blob-in-mysql\/","url_meta":{"origin":1163,"position":0},"title":"How to get size of BLOB in MySQL","author":"Virendra Chandak","date":"December 23, 2012","format":false,"excerpt":"Recently I wanted to get the size of the data stored in the BLOB field of a MySQL table. BLOB is a field which can be used to store variable amount of data. There is a simple MySQL String function, to find the size of BLOB data, OCTET_LENGTH. This function\u2026","rel":"","context":"In &quot;MySQL&quot;","block_context":{"text":"MySQL","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1045,"url":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-find-and-replace-data-in-mysql\/","url_meta":{"origin":1163,"position":1},"title":"How to Find and Replace Data in MySQL","author":"Virendra Chandak","date":"August 5, 2012","format":false,"excerpt":"Recently, while migrating my blog, I had to find all the occurrences of my old URL and replace it with my URL. One way of doing this was to get a database dump, open it in a text editor and the do a find replace and the import it back.\u2026","rel":"","context":"In &quot;MySQL&quot;","block_context":{"text":"MySQL","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1199,"url":"https:\/\/www.virendrachandak.com\/techtalk\/sample-mysql-table\/","url_meta":{"origin":1163,"position":2},"title":"Sample MySQL table","author":"Virendra Chandak","date":"September 16, 2012","format":false,"excerpt":"For my MySQL posts here is a sample MySQL table that I would be using for my examples. I would refer my posts back to this for table structure and sample data. Table structure: +---------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------+-------------+------+-----+---------+-------+ |\u2026","rel":"","context":"In &quot;MySQL&quot;","block_context":{"text":"MySQL","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1997,"url":"https:\/\/www.virendrachandak.com\/techtalk\/mysql-int11-what-does-it-means\/","url_meta":{"origin":1163,"position":3},"title":"What does int(11) means in MySQL?","author":"Virendra Chandak","date":"August 10, 2016","format":false,"excerpt":"A very common misconception about what int(11) means in MySQL is that the column can store maximum integer value with 11 digits in length. However, this is not true. int(11) does not determines the maximum value that the column can store in it. 11 is the display width of the\u2026","rel":"","context":"In &quot;MySQL&quot;","block_context":{"text":"MySQL","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1968,"url":"https:\/\/www.virendrachandak.com\/techtalk\/creating-csv-file-using-php-and-mysql\/","url_meta":{"origin":1163,"position":4},"title":"How to create CSV file using PHP","author":"Virendra Chandak","date":"April 19, 2015","format":false,"excerpt":"CSV (comma-separated values) is one of the most popular methods for transferring tabular data between applications. Lot of applications want to export data in a CSV file. In this article we will see how we can create CSV file using PHP. We will also see how to automatically download the\u2026","rel":"","context":"In &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/php\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2769,"url":"https:\/\/www.virendrachandak.com\/techtalk\/what-is-clickhouse\/","url_meta":{"origin":1163,"position":5},"title":"What Is ClickHouse, and When Should You Use It?","author":"Virendra Chandak","date":"July 21, 2026","format":false,"excerpt":"ClickHouse is an open-source columnar database built for analytics at massive scale: fast aggregation and filtering over very large datasets. ClickHouse may look like a relational database, but it\u2019s engineered for a fundamentally different purpose than Postgres or MySQL, and treating it as a drop-in replacement is the most common\u2026","rel":"","context":"In &quot;Clickhouse&quot;","block_context":{"text":"Clickhouse","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/clickhouse\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/1163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/comments?post=1163"}],"version-history":[{"count":0,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/1163\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/media?parent=1163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/categories?post=1163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/tags?post=1163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}