Home > Software design >  What is the difference between the terms "column" and "field" in SQL Server?
What is the difference between the terms "column" and "field" in SQL Server?

Time:10-31

For some time now I have the impression that a field and a column are the same thing in SQL server but today I stumbled across the statement that they are not actually the same thing. It was stated that a field is the intersection of a row and a column, so if a table has 10 rows and 10 columns it will have 100 fields in total.

I looked at Microsoft Docs and this is what it says:

A column is collection of cells aligned vertically in a table. A field is an element in which one piece of information is stored, such as the eceived field. Usually, a column in a table contains the values of a single field.

In this case then it looks like they are not the same thing.

I would highly appreciate it if someone can clarify this! Thank you in advance!

CodePudding user response:

A field is part of a row, not a table, a "column of a row", if you will.

However, a lot of people use these terms interchangeably, and you can (read: have to) often deduce what they actually meant by the context of the sentence.

CodePudding user response:

In some contexts, a field may refer to an element within a data value, where a column contains the entire data value. A common example is a date data type, where the month, day, and year are fields within the column. Spatial data types (e.g., the PostGIS data type in Postgres) is another example, where the x coordinate, y coordinate, and spatial reference ID are all fields within the column. Some kinds of identifiers have application-specific fields within them, where, for example, the first two characters carry some information, the next four characters convey some other information, etc. In cases like these, the distinction between column and field is important.

  • Related