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

  • SEARCH
  • Home
  • 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 8454345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:00:13+00:00 2026-06-10T12:00:13+00:00

Simplified situation: I have a table, let’s call it header with, say, a primary

  • 0

Simplified situation:
I have a table, let’s call it header with, say, a primary key header_ID, and some other attributes

I will be needing to flag those rows with different filters. I can’t know in advance how many, but for most rows it will be between 0 to 10.

So, I thought of creating another table (let’s call it filter) with attributes h_ID and filter_ID. So, if this table has the following it would mean that header_ID=2 was flagged with the filter 1 and 3, and header_ID=3 with filter 1

2 1
2 3
3 1

Then, another table with filter_ID and an attribute with some text describing the filter.

The basic query that I see myself doing often is, for example, “get certain rows from header that don’t have any filters”. Is this a design that makes these types of queries efficient? If so, how?

I was thinking about perhaps adding a filter_ID column to header, and replacing header_ID column with a filter_ID primary key, that will have value NULL in header when no filters have been assigned. Is that a better idea?

I appreciate your input

  • 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. Editorial Team
    Editorial Team
    2026-06-10T12:00:14+00:00Added an answer on June 10, 2026 at 12:00 pm

    You can do a left join and then filter to only get rows with null values in the left table.

    SELECT [cols]
    FROM header
    LEFT JOIN filters 
    ON header_id=h_id
    WHERE [filter col] IS NULL
    

    By the descriptions of your tables, it would be a pretty bad idea to have a filter column in the header table. It would lead to some pretty inefficient queries.

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

Sidebar

Related Questions

I have a situation where I have 2 Activity objects (let's say empty and
I need some help with the following situation: Very simplified table users_log +-----------------+-------------------+ |
I have following situation (simplified, of course): MyDomain.groovy: class MyDomain { MyAnotherDomain anotherDomain //
This is my situation, very much simplified. My classes; public class ClassBase { [Key]
Basically the situation is like this (simplified, pseudo code): I have 2 TABLES person
http://jsfiddle.net/AndyMP/nUhhf/1/ This is a simplified situation where I have a DIV that animates downwards
I have the following situation (I know it doesn't sound real but I simplified
I have a generic interface hierarchy which describes some controllers for other generic types,
THE SITUATION So here's a simplified version of my situation: I have a Payment
I have a situation where my language contains some words that aren't known at

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.