473,763 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is "name" a keyword?

It's blue in SQL Studio but I can't find it in SQL Books on-line. I
wanted to use it as a field name but don't like using [].

Is it reserved?

Dec 27 '05 #1
6 17420
It is not a keyword in Standard SQL, but it is too vague to be a column
or other data element name by itself

It is a modifier -- think about what it. Name?? Name of what?
Employee? Pet? Product? etc.

Also a field is a totally different concept from a column!.

Dec 27 '05 #2
Cecil wrote:
It's blue in SQL Studio but I can't find it in SQL Books on-line. I
wanted to use it as a field name but don't like using [].

Is it reserved?


It's reserved for the inexperienced who won't bother to come up with a
more useful and informative name. The rest of us know better because
we've had too many bad experiences trying to make sense of other
people's designs with fatuous names like "ID", "NAME", "DATE" or (I kid
you not) "DATA".

--
David Portas
SQL Server MVP
--

Dec 27 '05 #3
OK, can you help me to understand why ID and name are poor field
choices. I am asuming it has to do w/ ambiguity. I always qualify
fields w/ their table names for precisely this reason, so I always
concidered something like Category.catego ryID to be very redundant.

I prefer Category.ID and Category.name. The only time I would write
CategoryID is if it was a foreign key linking to the "ID" field in the
Category table.

If you believe this to be poor practice, would you please explain why?
Thanks.

Dec 28 '05 #4
Cecil wrote:
OK, can you help me to understand why ID and name are poor field
choices. I am asuming it has to do w/ ambiguity. I always qualify
fields w/ their table names for precisely this reason, so I always
concidered something like Category.catego ryID to be very redundant.

I prefer Category.ID and Category.name. The only time I would write
CategoryID is if it was a foreign key linking to the "ID" field in the
Category table.

If you believe this to be poor practice, would you please explain why?
Thanks.


Naming conventions are supposed to aid understanding, verification,
interchange, and ongoing maintenance of code by others. Generally
accepted standards and conventions therefore ought to be more important
than personal preferences. Quote: "Any fool can write code that a
computer can understand. Good programmers write code that humans can
understand." (Martin Fowler). The same applies to your data model.
There is in fact an international standard for naming data elements:
http://metadata-standards.org/

One principle that's very widely used and that works well is that every
single data element should have a unique name in your database schema.
That means that foreign keys usually have the same name as the column
that they reference and that most column names won't appear in more
than one table except where they are keys or part of compound keys.

The advantages of using unique names are many:

- When maintaining schema and code you can easily search for column
name references in your code because each column has a unique name.
Your idea of qualifying each with the table name won't work because in
correlations and multiple joins to the same table you may be forced to
use aliases rather than table names. That means you can never reliably
search for a particular column. You'll have to manually check for each
occurence of "NAME" to see if it's the right one.

- Types and constraints can be defined and checked by column name
throughout the database. This is ideally suited to systematic auditing
of the schema, something which ought to be part of any implementation.

- Data dictionaries can be smaller and simpler to use by referencing
each element name rather than each table and name.

- Your code will be more readable if you use short aliases but that
only helps if you use concise and meaningful column names.

- Data interchange with XML for example is also made easier if you use
unique names for data elements.

- You'll be much less likely to clash with present and future reserved
keywords because most keywords are simple nouns or verbs whereas the
column names that are likely to conflict with them are usually
compounds.

--
David Portas
SQL Server MVP
--

Dec 28 '05 #5
David,

Thank you for your thoughtful reply. I will consider adopting your
recommendations .

Dec 28 '05 #6
I agree with 'DATE' and 'DATA' but ID and NAME, it depends on your style.

Its good practice to alias table's on the FROM clause and to specify the
alias when referencing those columns - it helps maintanence by knowing
clearly where columns are referenced from.

create table Logon (
id int not null....

The above declaration for instance, in a SQL statement you would write...

select logon_id = l.id
from Logon l

The table (set) is a container in the same way an object (table) is a
container, the object just contains properties (columns) though rather than
any methods.

My two cents.

Tony.

--
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"David Portas" <RE************ *************** *@acm.org> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Cecil wrote:
It's blue in SQL Studio but I can't find it in SQL Books on-line. I
wanted to use it as a field name but don't like using [].

Is it reserved?


It's reserved for the inexperienced who won't bother to come up with a
more useful and informative name. The rest of us know better because
we've had too many bad experiences trying to make sense of other
people's designs with fatuous names like "ID", "NAME", "DATE" or (I kid
you not) "DATA".

--
David Portas
SQL Server MVP
--

Dec 28 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2430
by: Todd Gardner | last post by:
Pardon my extremely ignorant newbie questions. Where can I go to find more information about the "self" argument? Is there something special about the word "self" or did Mr. Guido van Rossum just decide to us the word arbitrarily? More precisely it seems that most all classes have "self" as the first parameter. This may be directly obvious but is the word "self" always referring to the class or the function it is used in?
3
11904
by: Sean Berry | last post by:
How do I rectify this? ------vars.py------ #!/usr/local/bin/python def setUserid(value): userid = value def getUserid():
2
5620
by: Liang | last post by:
Hi, I use "defined $r_libs->{$name}" to check first if a key exists in a hash table. But Perl gives a warning WHENEVER the key exists: "Use of uninitialized value". Would u please help to check the script, and let me know the reason? Thanks in advance. Liang
2
17768
by: John Davis | last post by:
I want to know what's the differences between Request.Form("Field Name") and Request.QueryString("Field Name") OR they function exactly the same, which is to return the value of the field?? Thanks, John
3
2088
by: Alfred E Neuman | last post by:
I've read that... AClass ac = AClass( "name", 23 ); is less efficient than... AClass ac( "name", 23 ); because the first has to create a temporary object which is then assigned to ac. However, I can't seem to prove this true. I've created a class containing the following constructors and overloaded equal operator.
3
2706
by: Pavils Jurjans | last post by:
Hello, I have bumped upon this problem: I do some client-side form processing with JavaScript, and for this I loop over all the forms in the document. In order to identify them, I read their "name" property (which sources from "name" HTML attribue). The problem is, that if the form contains form control named "name", it overwrites the form name property. In fact, I'm quite surprised that it's so easy to spoil any of the form object...
1
9454
by: A.M-SG | last post by:
Hi, I am trying to simplify my app.config file. Can I have a section handler in a separated file? I am looking for something like this: <section name=".." type=".." file="..."> but it gives me error! Am I missing a specific syntax?
1
7084
by: mark | last post by:
Forgive me if this seems like a stupid question but I need help... I'm trying to do a simple online form that emails me the results from a few fields. Here is the code: <form action="http://cm1web1/WebSurveyComponents/script/ processform.asp" method="post">
1
12328
by: mato81 | last post by:
Hi all! I am a newbie to WSDL. I have a questions which has been driving me crazy... If I would have a WSDL with a types element somewhat like below, what is the point of the third last row "<s:element name="string" nillable="true" type="s:string"/>". Why is it there and what is it for? ... <wsdl:types> <s:schema elementFormDefault="qualified" targetNamespace="http://www.home.NET"> <s:element name="GetWeather">
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9998
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.