Skip to content
Advertisement

Tag: orm

Data Model for multiple checkboxes

I currently have a supplier table and now I want to store the regions served by each supplier. As a first thought, I made my supplier model like this : Does this seem to be a good pattern? Especially for queries to filter suppliers by region served etc. Is this solution still reliable if in the future I want to

SQL how do I sum up a has many relationship

So I have the following table, I managed to join users and membership tables just fine with a left join however I’ve been unsuccessful at summing up the individual customers’ total. Here’s my code, the one-to-one associations seem to be doing fine however the summing up of the total seems to not display, what am I doing wrong? is there

How to use variable column name in filter in Django ORM?

I have two tables BloodBank(id, name, phone, address) and BloodStock(id, a_pos, b_pos, a_neg, b_neg, bloodbank_id). I want to fetch all the columns from two tables where the variable column name (say bloodgroup) which have values like a_pos or a_neg… like that and their value should be greater than 0. How can I write ORM for the same? SQL query is

Unexpected result in WHERE clause on AI ID field

I have a table which’s name is users in my MySQL database, and I am using this DB with Ruby on Rails application with ORM structure for years. The table has id field and this field is configured as AI (auto-increment), BIGINT. Example of my users table; The problem I am facing is when I execute the following query I

Model hierarchy in Django [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 2 years ago. Improve this question Sorry for the long text Models are given: User Hierarchy class Hierarchy (Model): There are users, they can invite each

Orderby on multiple columns using typeorm

In my application, I am using MySQL and typeorm and want to do orderBy using multiple columns. I searched so many places for it but did not get any solution. Example: I have two columns in a table user and respective User Entity ________________________________________ | id | name | createDate | createdTime | —————————————- | 1 | Sai | 2020-12-12

Advertisement