Exec not working

I don’t understand this. Surely, ORDER BY lets you sort results according to

Yes but only in the retrieved results on this specific occasion. The data in the database itself remains in whatever order the database has them in .

Think of it like fish in an aquarium. They swim around and have no specific order unless you are using a net to transfer them to a different aquarium. Only then you extract them do they have an order.

Thanks @ahundiak,@oddz, @Mittineague, @felgall, and @droopsnoot ; I appreciate the time you have taken to help me. I thought the ORDER BY clause let you sort results according to the values in one or more rows before they’re returned, which is what I have been trying to do.
I have a database,* ijdb*, with a table,* lectures*, with column headings as in the code I posted earlier. There are eight rows of records. The code I have posted reorders the rows in date order as I want, but I don’t know how to pass that reordering back to the database. Am I chasing rainbows?

I think it’s more like you are wanting the database file to have your concept of “organized”.

This is not an uncommon human inclination.

For example, some have been concerned when after they have deleted some rows they discover that the database is not reusing auto-increment ids and newer ids are put into the space the deleted rows occupied.

Not to worry, though it may look disorganized and maybe even wasteful compared to how we might do things, to the database all is well

As long as your queries are returning what you want them to don’t fret about how the database organizes the data

Well, that’s true, but it only sorts them as part of the process of returning the information to your query, not by re-organising the database. So for the purposes of your query, they arrive in the order you wanted them, and when you want them in a different order, you don’t have to sort them again, just choose the order they appear in as part of your query. If you’re used to using file-based data storage it’s a bit of a different concept. If speed becomes an issue, you can index on various columns to improve performance.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.