Having this table as I would do so that row number 3 appears first in a query and the rest is like this .. but in the query all records appear, just vary the order
I would like the result of the consultation to be something like this
You can establish an arbitrary order by doing this:
SELECT *
FROM tuTabla
ORDER BY (id_carrera=3) DESC;
If for example, you want all the others ordered, except that, you can do:
SELECT *
FROM tuTabla
ORDER BY (id_carrera=3) DESC, id_carrera;
Or also set another order for another column, always having the 3
in first:
SELECT *
FROM tuTabla
ORDER BY (id_carrera=3) DESC, nombre;
Maybe I can help you using the "UNION" operator, in a first consultation you extract the row with id 3, in a second query you extract all the rows with identifier other than 3 and you order them up by id, to later use UNION operator and join the results of both queries and get what you want.
( SELECT *
FROM tuTabla
WHERE id = 3
)
UNION
(
SELECT *
FROM tuTabla
WHERE id != 3
ORDER BY id ASC
)