Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Is there a way to inform the database that some fields are default (have always the same value) so that I don't need include them in all my queries?

Suppose: Select ... where f1=a, f2=b, f3=c, f4=d

After preset f1 = a and f2 = b I have.

Select ... where f3=c, f4=d

To get the same return of the previous query

I don't have a clue if it is simple or impossible :-)

tkx all

share|improve this question
    
Is it always the same query except tha values of f3 and f4? If so, you can use bind variables. –  miracle173 Mar 18 at 9:08
    
@psa do you mean that in the table, all the rows have the same value in column f1? If that's the case, you can have the column as calculated or virtual. It doesn't have to be stored at all. –  ypercube Mar 18 at 9:15
    
@psa: would you be so kind to suplly mor information. What kind of database / application. What type of quey? Why do you think that a feature is useful? –  miracle173 Mar 18 at 9:40
    
miracle 173, I forgot to mention I'm using Firebird. The value of f1 and f2 are the same for one subset of the table (more than one table) and I want to perform updates on this subset of values. I'm working on a recursive thing so f1 and f2 are always the same and I need handle (query/delete/insert) only f3 and f4 without care f1 and f2 since they have the same value for a subset. I'm researching now ypercube tip (calculated and virtual) and it seems 'view' give the subset I want to handle but I'm not sure if I can apply updates in a view and could see other users insertions in that view that' –  psa Mar 18 at 12:43
    
Is it a subset or the whole table that has these default values? If it's a subset, how do you expect WHERE f3=c AND f4=d to select rows from only this subset? –  ypercube Mar 18 at 13:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.