200 likes | 287 Views
Databasics. A primer on data structures. What is data?. Everything. Everything is a datum. Seriously. Pretty much by definition * . But some data are better than other data. And, crucially, how you choose to record your data dramatically affects its usability. * Irrelevant aside:
E N D
Databasics A primer on data structures
What is data? • Everything. • Everything is a datum. • Seriously. Pretty much by definition*. • But some data are better than other data. And, crucially, how you choose to record your data dramatically affects its usability. *Irrelevant aside: Physicist John Wheeler argues that the boolean bit, the basic quantum of information, is also the smallest possible unit of the physical universe.
Ways to store data • Sticky notes • Pictures • Static web pages • PDFs • Documents • Spreadsheets • Databases Simplicity Power
Advantages of a database • Strongly-typed data • Automated validation and constraints • Simultaneous shared access • Centralization of data • Security • Performance • Reliability
Disadvantages of a Database • Requires architectural consideration • Requires user management • Requires user interfaces for data input and retrieval (which may or may not be provided by the DBMS selected; prosumer databases like MS Access and FileMaker Pro generally have very usable templates.)
Databases in use at Edgewood • Jenzabar EX • PowerFAIDS (SQL and MS Access) • WWW & My.Edgewood websites • Education Department (FileMaker) • ITSO Inventory • Printer/Copier Management … and many, many more.
SCHEMATICS A BASIC OVERVIEW OF DATABASE OBJECTS
Tables: Lists of Lists • Each row represents one data transaction • Columns store data points relevant to that transaction • Can be infinitely large (depending on platform), but performance suffers eventually
Keys • The most important fields in a table; usually included by default in any index • A “primary key” is a key which holds only the data fields that must be used to uniquely identify a single record: • Sequence numbers (incrementing integers) • Globally Unique IDentifierS • Unique combinations of data across several fields
Relational Data • How data from one table is associated with data in another table. • Joined via “relationships” recorded as “foreign keys” in the child table. • The hardest and most important part of database design.
Queries • The mechanism by which everything happens – Create, Read, Update, and Delete. • Structured Query Language allows direct communication with a database engine over an established database connection (generally via an Open DataBase Connectivity object). INSERT INTO STAGE_HISTORY_TRAN (ID_NUM, HIST_STAGE, TRANSACTION_SEQ, YR_CDE, TRM_CDE, PROG_CDE, DIV_CDE, LOCA_CDE, DEPT_CDE, HIST_STAGE_DTE, ADD_TO_COUNT_DUP, USER_NAME, JOB_NAME, JOB_TIME) SELECT TOP 1 ID_NUM, dbo.[CUS_ReturnAcceptedStageCode](HIST_STAGE), TRANSACTION_SEQ + 1, YR_CDE, TRM_CDE, PROG_CDE, DIV_CDE, LOCA_CDE, DEPT_CDE, @DTE, 'Y', 'sa', 'AcceptCand', GETDATE() FROM STAGE_HISTORY_TRAN WHERE ID_NUM = @ID_NUM ORDER BY TRANSACTION_SEQ desc, HIST_STAGE_DTE desc;
Stored Procedures/Functions • Scripts written in Transactional SQL that can perform updates, execute programs (like automatic emails), and/or calculate data. • Often used to process data in large batches. • Functions like GetCurrentTerms() or CalcNextPayDate() can simplify business logic. • Can be assigned to run on a regular schedule or triggered by data changes.
ANALYTICS getting your data back out
Structured Query Language • SQL is the most widely accepted scripting language used to communicate with modern databases, although there are several variants and exceptions. • Almost all tools that allow you to drag and drop tables and select fields using a visual editor are actually writing SQL code for you behind the scenes. • SQL is easier than it looks; there are only a handful of objects and operators (nouns and verbs), meaning that it is relatively simple to read and write. Want to learn SQL for free? It’s more fun than a fair number of things which are not fun. Start here: http://www.w3schools.com/SQL/
Still Interested? • Ask us about our fabulous Infomaker and Reporting Tools Overview Presentation! • Disclaimer: No puppies included
QUESTIONS? Want more? Nostalgic for this presentation already? Get these slides – and special bonus material – here: http://tinyurl.com/73qq59q