Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 88095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:30:21+00:00 2026-05-10T22:30:21+00:00

I have a table named categories, which contains ID(long), Name(varchar(50)), parentID(long), and shownByDefault(boolean) columns.

  • 0

I have a table named categories, which contains ID(long), Name(varchar(50)), parentID(long), and shownByDefault(boolean) columns.

This table contains 554 records. All the shownByDefaultValues are ‘false’.
When I execute ‘select id, name from categories’, pg returns me all the categories, orderer by its id.
Then I update some of the rows of the table(‘update categories set shownByDefault where parentId = 1’), update OK.
Then, when I try to execute the first query, which returns all the categories, they are returner with a very weird order.
I do not have problem to add ‘order by’, but since I am using JPA to get this values, anyone knows what the problem is or if there is a way to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:30:22+00:00Added an answer on May 10, 2026 at 10:30 pm

    That’s not a problem. The order of rows returned by a SQL SELECT is undefined unless it has an ORDER BY. The order you get them is usually influenced by the order they are stored in the table and/or the indices that are used by the statement.

    So depending on that order without using ORDER BY is a very, very bad idea.

    If you need them in some order, simply specify that.

    It is important that a table is a set of rows and not a sequence of rows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table (named Topics) which includes these fields : topicId name
I have a table which contains a list of categories and and another table
I have a categories table that looks like this: id | name | parent
I have a table named Info of this schema: int objectId; int time; int
I have a table named visiting that looks like this: id | visitor_id |
I have a database table named call with columns call_time, location, emergency_type and there
I have a table in my Postgres database with columns named type, desc, and
If I have a table like this: CREATE TABLE sizes ( name ENUM('small', 'medium',
I have an ASP.NET MVC view which contains checkboxes for user-defined categories. <td><% foreach
I have a table of destinations ( states ) which contain primary level categories

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.