Monday, July 30, 2018

Tables and their parts





-- Database by Doug
-- Douglas Kline
-- 7/30/2018
-- Terminology : Tables, Columns, Rows

use Northwind

-- no pre-requisites

-- a very good way to organize data is in a table

-- why? 

-- mainly because humans find tables fairly easy to understand
-- what they should look like, how they should behave, how to look things up, etc.

-- for example, lets say I show somebody this table:

SELECT *
FROM ( VALUES
   ('Doug','2'),
   ('Dan', '3'),
   ('Debbie', '1'),
   ('2','Joe')) AS tbl([Name], [Number])

-- Most people will think that is weird
-- why is there a number in the Name column?

-- we know this innately, without knowing any special theory

-- we like it this way, because it keeps things organized

-- organized data is easy to get value out of

-- so let's go over some terminology, looking at some real table data

SELECT  ProductID,
   ProductName,
   Unitprice,
   UnitsInstock,
   QuantityPerUnit,
   Discontinued
FROM  Products

-- **highlighting entire table
-- the entire table is also sometimes called:
-- an entity, a table, a file, an object

-- entity - usually used by data modelers/architects
-- table - usually used by database analysts
-- file  - usually used by database administrators (especially of old databases, where each table was stored as a file) 
-- object - usually used by software developers (especially object-oriented developers, where an object maps to a table)

-- **highlighting a row
-- one row in a table also has several names:
-- row, record, entity instance, object instance

-- row  - used by most people, in other words its just a part of a table that's horizontal
-- record - usually used by database analysts, this is special terminology for db people
-- entity instance - usually used by data modelers/architects
-- object instance - usually used by software developers

-- **highlighting a column
-- one column in a table has several names:
-- column, attribute, field, property

-- column - used by most people, in other words its just a part of a table that's vertical
-- attribute- or entity attribute, used by data modelers, some value of interest about an entity
-- field - used by database analysts, special terminology for db people
-- property - or object property, used by OO software developers, object properties usually map to table fields

-- ** highlighting a cell
-- one cell, an intersection of a row and column has several names:
-- cell, value, field, field value, attribute, attribute value, property, property value, etc.

-- careful...

-- sometimes attribute means an entire column, e.g., Person table has an attribute named firstName
-- sometimes attribute means a single cell, e.g., Doug's firstName attribute is Doug

-- thanks for watching

-- Database by Doug
-- Douglas Kline
-- 7/30/2018
-- Terminology : Tables, Columns, Rows

No comments:

Post a Comment

Followers