Reputation: 319
According to the book I have:
Fields and records are physical. Fields are what you have in user interfaces in client applications, and records are what you have in files and cursors. Tables are logical, and they have logical rows and columns.
I honestly have no idea what the author is talking about. Can someone kindly explain to me in layman terms what the differences are. Please no geeky/nerdy explanations. Just something that a newbie can understand. Thank you so much.
Upvotes: 0
Views: 47
Reputation: 1079
Fields / Columns represents what kind of data will be stored
while
Records / Rows represents the actual data stored.
The table is the collection of columns / fields that holds your data.
Example table named person
Person Name Age John 30 Peter 29 Michael 25
Name and age are what fields / columns are, while john, peter, michael and ages are what records / rows are.
Upvotes: 1
Reputation: 743
I've been doing SQL for 20+ years and to be honest, I don't think you need to worry about fields and records. Everything in SQL is oriented around rows and columns. If you've ever looked at a spreadsheet that should be pretty intuitive.
In SQL you have actual physical tables that define real rows and columns.
Then you create SELECT queries on those tables to get data out. You can think of every SELECT query as creating a "logical" table for your results where you can JOIN column values from different rows in different tables. The join uses something the rows have in common, like perhaps they both have a column with the same value.
So you may have 2 physical tables:
Table: User
UserID Name
------ ----
1 John Smith
Table: UserAddress
UserID Address
------ -------
1 123 Main St.
And you might do a query like this:
SELECT
User.UserID, User.Name, UserAddress.Address
FROM
User
INNER JOIN
UserAddress
ON
User.UserID = UserAddress.UserID
You can think of the result as a logical table containing three columns: UserID, Name and Address.
If your book is calling these Fields and Records don't worry about it. It's the same thing. Every API I've seen treats the result set you get back as rows and columns anyway. For example ADO.NET Has a result called a DataTable which as a properties called Rows and Columns.
Upvotes: 4