Results 1 to 3 of 3

Thread: Database querry

  1. #1
    Join Date
    Oct 2014
    Posts
    1

    Unanswered: Database querry

    Hi. I'm new here and this is my first post. Very glad to meet you all.

    I have three tables:
    URL: URL_ID, URL
    urlType: urlTYPE_ID, Type
    urlDescription: urlDescription_ID, Description
    urlSpecialization: urlSpecialization_ID, Specialization

    I also have a junction table, urlTDS: urlTDS_ID_FK, Type_FK, Description_FK, Specialization_FK.

    I have many url addresses that have duplicate information like type, description and specialization. I am opened to suggestions if my current design isn't good/ can be improoved.
    I want to make a join querry that will add the data toghether: url, type, description, specialization.

    Thank you

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    496
    Provided Answers: 24
    If you dont want duplicates, then INDEX the field with NO duplicates.

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Id also suggest renaming your columns. theres nearly as many naming conventions in the systems world as there are people working in the systems world
    but use one that is specific to SQL/Relationsl databases
    tables are plurals
    dont' repeat the table name in its columns (why.. its looks fugly
    urlDescription: ID, Description as opposed to urlDescription: urlDescription_ID, Description
    use either CamelCase or all lower case separated by underscore
    use the abbreviations where useful
    names should be descriptive of what they are so you and those following you can understand from the context what the data represents
    make certain you don't use any of the reserved words in Access (and ideally in SQL)
    be aware of the length limits of table / column names (in some dbs its 32 characters, and some SQL engines will let you define columns as loing as you want but when querying will just find the first column within its length limit
    https://www.google.co.uk/webhp?sourc...served%20words
    https://www.google.co.uk/webhp?sourc...reserved+words

    none of the above is required/mandatory, its just a suggestion
    if your tables are easy to read they are usuyally easier to understand.

    if it were me I'd probably use:-
    Code:
    URL: ID, URL
    urlTypes: ID, TypeDesc   *type is a reserved word
    urlDescs: ID, Description  *Desc is a reserved word
    urlSpecs: ID, Specialisation
    urlTDS: TypeID, URLDescID, URLSpecID[/code]

    I don't see why you feel you need urlTDS_ID_FK, it doesn't do anything and isn't a FK
    use table alias where appropriate in queries eg;-
    select T1.URL, T2.TypeDesc, T3. Description from URLTDS as T4
    join URLs as T1 on T4.URLID = T1 ID
    .....
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •