• SQLAddict01 - Friday, March 2, 2018 3:07 PM

    CREATE TABLE FileMeta(Id [Some Data Type] NOT NULL, ParentId [Some Data Type] NOT NULL, Type CHAR(1) NOT NULL /* F = File or D = Directory */, AccountId [Some Data Type] NOT NULL, Name VARCHAR(255))
    SELECT …FROM FileMetaWHERE AccountId = [Foo]AND Id = [Bar]
    SELECT …FROM FileMetaWHERE AccountId = [Foo]AND Name = ‘[Some Name]’

    trying to understand and design indexes
    how would you choose indexes?

    So, back to you, SQLAddict01 .  What are you actually going to use this table for?  What is the business logic that you will attempt that this table is supposed to help solve?  Of course, the reason for me asking is because you haven't actually defined the problem that the table will be used to solve and so all of our recommendations (and yours) may be out in left field.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)