How to do custom order by in mysql [closed] - mysql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed yesterday.
Improve this question
i have a table with different names. i can order alphabetically, but i want to order it in different way.
For example: i want 'H' to be the first set of rows in the table, then 'D', then 'A' like that. how to pass this query in mysql?

Related

What is the alternative of a Mysql Select query using OR operator? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 days ago.
Improve this question
I have a query like:
SELECT * from table where column1=5 or column2=8
I need an alternative query to the above query. How is that possible?
I cannot guess the exact answer.

Order by integer keep null in middle of positive and negative value mysql [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have value in a column of table like-
3,2,null,4,-1,-4,-2.
I want result like
4,3,2,null,-1,-2,-4.
You want NULL treated as a zero:
order by coalesce(column, 0) desc

Want to change prefix of values in mysql database [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have millions of data in my database table customer. In that, I have the id_token attribute which has value like cus00001 format now I want to change it to ank00001.
What will be the query in rails or mysql to do it for all the data in the database?
You can use simple update query using REPLACE function:
UPDATE `table_name` SET `id_token` = REPLACE(`id_token`, 'ank', 'cus');

To Display Duplicate Records Only...in only one column which having so duplicate values? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
A table having duplicate record columns... I need to just show how many duplicate values present in that particular column...not unique values...Only Duplicate values should be displayed?
Do a count with groupby, and then filter the ones that have duplicates with having your_count_column > 1

Mysql Order by a first column and then second one [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'd have to make a SELECT ordering by first a column and then by another column... Is it possibile?
SELECT * FROM table_name ORDER BY colum1, column2