Thread: Database querry
10-16-14, 04:55 #1Registered User
- Join Date
- Oct 2014
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.
10-16-14, 10:33 #2Registered User
Provided Answers: 25
- Join Date
- Apr 2014
If you dont want duplicates, then INDEX the field with NO duplicates.
10-16-14, 13:33 #3Jaded Developer
Provided Answers: 59
- Join Date
- Nov 2004
- out on a limb
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
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:-
URL: ID, URL urlTypes: ID, TypeDesc *type is a reserved word urlDescs: ID, Description *Desc is a reserved word urlSpecs: ID, Specialisation
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