SQL select query order by on where in How Can I make the order by based on what I input on where?

example query

select * from student where stud_id in (
'5',
'3',
'4'
)


the result would be

id|   name  |
5 |  John   |
3 |  Erik   |
4 | Michael |


Kindly help me thanks.
There is no such direct language construct. If you want to do an "unnatural order" (based on the data type), then you can either join to some other table that maps the values and has another column to define the order for each value, or you can use CASE in your ORDER BY, such as

CREATE TABLE t(col int IDENTITY)
INSERT INTO t DEFAULT VALUES
GO 8

SELECT * 
FROM t
WHERE col IN(5, 3, 4)
ORDER BY
 CASE col 
  WHEN 5 THEN 1
  WHEN 3 THEN 2
  WHEN 4 THEN 3
 END


I'm using int above, but that doesn't change the concept. If you don't like repeating the "list of values" in the ORDER BY as well as the WHERE you can skip the WHERE and do a TOP for as many rows that you want. In any case, not neat, but since there isn't such language construct...