May 1, 2007, 1488 pages
Buy this book
This excerpt from “Special Edition Using Microsoft Office Access 2007” discusses Moving from Spreadsheets to Databases, Defining the Structure of Relational Databases, Maintaining Data Integrity and Accuracy and more.
In this chapter
Moving from Spreadsheets to Databases
Reliving Database History
Defining the Structure of Relational Databases
Conforming to Table Design Rules
Choosing Primary Key Codes
Maintaining Data Integrity and Accuracy
Displaying Data with Queries and Views
In the Real World—When and Why Learn Relational Theory?
Moving from Spreadsheets to Databases
Word processing and spreadsheet applications were the engines that drove the fledgling personal computer market. In the early PC days, WordPerfect and Lotus 1-2-3 dominated the productivity software business. Today, most office workers use Microsoft Word and Excel on a daily basis. It’s probably a safe bet that there’s more data stored in Excel spreadsheets than in all the world’s databases. It’s an equally good wager that most new Access users have at least intermediate-level spreadsheet skills, and many qualify as Excel power users.
Excel’s 2007 Data ribbon offers elementary database features, such as sorting, filtering, validation, and data entry forms. You can quickly import and export data in a variety of formats, including those of database management applications, such as Access. Excel’s limitations become apparent as your needs for entering, manipulating, and reporting data grow beyond the spreadsheet’s basic row-column metaphor. Spreadsheets basically are list managers; it’s easy to generate a simple name and address list with Excel. If your needs expand to contact management and integrating the contact data with other information generated by your organization, a spreadsheet isn’t the optimal approach.
The first problem arises when your contacts list needs additional rows for multiple persons from a single company. You must copy or retype all the company information, which generates redundant data. If the company moves, you must search and replace every entry for your contacts at the firm with the new address. If you want to record a history of dealings with a particular individual, you add pairs of date and text columns for each important contact with the person. Eventually, you find yourself spending more time navigating the spreadsheet’s rows and columns than using the data they contain.
Contact lists are only one example of problems that arise when attempting to make spreadsheets do the work of databases. Tracking medical or biological research data, managing consulting time and billings, organizing concert tours, booking artist engagements, and a myriad of other complex processes are far better suited to database than spreadsheet applications.
Moving to a relational database management system (RDBMS), such as Access, solves data redundancy and navigation problems, and greatly simplifies updating existing information. After you understand the basic rules of relational database design, Access makes creating highly efficient databases quick and easy. Access 2007 has a collection of wizards to lead you step-by-step through each process involved in developing and using a production-grade database application. Unfortunately, there’s no “Relational Wizard” to design the underlying database structure for you.
Tip – If your goal is learning relational database fundamentals, start with Access 2007. Access is by far the first choice of universities, colleges, trade schools, and computer-training firms for courses ranging from introductory data management to advanced client/server database programming. The reason for Access’s popularity as a training platform is its unique combination of initial ease of use and support for advanced database application development techniques.
Reliving Database History
Databases form the foundation of world commerce and knowledge distribution. Without databases, there would be no World Wide Web, automatic teller machines, credit/debit cards, or online airline reservation systems. Newsgathering organizations, research institutions, universities, and libraries would be unable to categorize and selectively disseminate their vast store of current and historical information. It’s difficult to imagine today a world without a network of enormous databases, many of which probably contain a substantial amount of your personal data that you don’t want to be easily available to others.
The Early History of Databases
The forerunner of today’s databases consisted of stacks of machine-readable punched cards, which Herman Hollerith used to record the 1890 U.S. census. Hollerith formed the Computing-Tabulating-Recording Company, which later became International Business Machines. From 1900 to the mid-1950s, punched cards were the primary form of business data storage and retrieval, and IBM was the primary supplier of equipment to combine and sort (collate) punched cards, and print reports based on punched-card data.
Note – Jim Gray’s article “Data Management: Past, Present, and Future,” which is available as a Microsoft Word document at http://research.microsoft.com/~gray/DB_History.doc, offers a more detailed history of data processing systems. Dr. Gray is a senior researcher and the manager of Microsoft’s Bay Area Research Center (BARC).
The development of large computer-maintained databases—originally called databanks—is a post–World War II phenomenon. Mainframes replaced punched cards with high-capacity magnetic tape drives to store large amounts of data. The first databases were built on the hierarchical and network models, which were well suited to the mainframe computers of the 1950s. Hierarchical databases use parent-child relationships to define data structures, whose diagrams resemble business organization charts or an inverted tree with its root at the top of the hierarchy. Network databases allow relaxation of the rules of hierarchical data structures by defining additional relationships between data items. Hierarchical and network databases ordinarily are self-contained and aren’t easy to link with other external databases over a network.
Note – Hierarchical databases remain alive and well in the twenty-first century. For example, data storage for Windows 2000’s Active Directory and Microsoft Exchange Server is derived from the hierarchical version of Access’s original relational Jet databases. The name Jet comes from the original Access database engine called Joint Engine Technology.
The Internet’s Domain Name System (DNS) is a collection of hierarchical databases for translating character-based Internet domain names into numerical Internet Protocol (IP) addresses. The DNS database is called a distributed database, because its data is held by a global network of thousands of computers.
Early databases used batch processing for data entry and retrieval. Keypunch operators typed data from documents, such as incoming orders. At night, other operators collated the day’s batch of punched cards, updated the information stored on magnetic tape, and produced reports. Many smaller merchants continue to use batch processing of customer’s credit-card purchases, despite the availability of terminals that permit almost instantaneous processing of credit- and debit-card transactions.
The Relational Database Model
Dr. E. F. Codd, an employee of IBM Corporation, published “A Relational Model of Data for Large Shared Databanks” in a journal of the Association for Computing Machinery (ACM) in June 1970. A partial copy of the paper is available at http://www.acm.org/ classics/nov95/. Dr. Codd’s specialty was a branch of mathematics called set theory, which includes the concept of relations. He defined a relation as a named set of tuples (records or rows) that have attributes (fields or columns). One of the attributes must contain a unique value to identify each tuple. The common term for relation is a table whose presentation to the user is similar to that of a spreadsheet.
Note – This book uses the terms field and record when referring to tables, and columns and rows when discussing data derived from tables, such as the views and query result sets described later in this chapter.
Relational databases solve a serious problem associated with earlier database types. Hierarchical and network databases define sets of data and explicit links between each data set as parent-child and owner-member, respectively. To extract information from these databases, programmers had to know the structure of the entire database. Complex programs in COBOL or other mainframe computer languages are needed to navigate through the hierarchy or network and extract information into a format understandable by users.
Dr. Codd’s objective was to simplify the process of extracting formatted information and make adding or altering data easier by eliminating complex navigational programming. During the 1970s, Dr. Codd and others developed a comparatively simple language, Structured Query Language (SQL), for creating, manipulating, and retrieving relational data. With a few hours of training, ordinary database users could write SQL statements to define simple information needs and bypass the delays inherent in the database programming process. SQL, which was first standardized in 1985, now is the lingua franca of database programming, and all commercial database products support SQL.
Note – The most widely used SQL standard, SQL-92, was published by the American National Standards Institute (ANSI) in 1992. Few, if any, commercial relational database management systems (RDBMSs) today fully conform to the entire SQL-92 standard. The later SQL-99 (also called SQL3) and SQL-200n specifications add new features that aren’t germane to Access databases.
RDBMS competitors have erected an SQL Tower of Babel by adding nonstandard extensions to the language. For example, Microsoft’s Transact-SQL (T-SQL) for SQL Server, which is the subject of Chapter 21, “Moving from Access Queries to Transact-SQL,” has many proprietary keywords and features. Oracle Corporation’s Oracle:SQL and PL/SQL dialects also have proprietary SQL extensions.
Client/Server and Desktop RDBMSs
In the early database era, the most common presentation of data took the form of lengthy reports processed by centralized, high-speed impact printers on fan-folded paper. The next step was to present data to the user on green-screen video terminals, often having small printers attached, which were connected to mainframe databases. As use of personal computers gained momentum, terminal emulator cards enabled PCs to substitute for mainframe terminals. Mainframe-scale relational databases, such as IBM’s DB2, began to supplement and later replace hierarchical and network databases, but terminals continued to be the primary means of data entry and retrieval.
Oracle, Ingres, Informix, Sybase, and other software firms developed relational databases for lower-cost minicomputers, most of which ran various flavors of the Unix operating system. Terminals continued to be the primary data entry and display systems for multiuser Unix databases.
The next step was the advent of early PC-based flat-file managers and relational database management systems. Early flat-file database managers, typified by Jim Button’s PCFile for DOS (1981) and Claris FileMaker for Macintosh (1988) and Windows (1992), used a single table to store data and offered few advantages over storing data in a spreadsheet. The early desktop RDBMSs—such as dBASE, Clipper, FoxBase, and Paradox—ran under DOS and didn’t support SQL. These products later became available in multiuser versions, adopted SQL features, and eventually migrated to Windows. Access 1.0, which Microsoft introduced in November 1992, rapidly eclipsed its DOS and Windows competitors by virtue of Access’s combination of graphical SQL support, versatility, and overall ease of use.
PC-based desktop RDBMSs are classified as shared-file systems, because they store their data in conventional files that multiple users can share on a network. One of Access’s initial attractions for users and developers was its capability to store all application objects—forms, reports, and programming code—and tables for a database application in a single .mdb file. FoxPro, dBASE, Clipper, and Paradox require a multitude of individual files to store application and data objects. Today, almost every multiuser Access application is divided (split) into a front-end .accdb file, which contains application objects and links to a back-end database .accdb file that holds the data. Each user has a copy of the front-end .accdb file and shares connections to a single back-end .accdb file on a peer Windows workstation or server.
Client/server RDBMSs have an architecture similar to Access’s front-end/back-end shared-file multiuser configuration. What differentiates client/server from shared-file architecture is that the RDBMS on the server handles most of the data-processing activity. The client front end provides a graphical user interface (GUI) for data entry, display, and reporting. Only SQL statements and the specific data requested by the user pass over the network. Client/server databases traditionally run on network operating systems, such as Windows and Unix, and are much more robust than shared-file databases, especially for applications in which many users make simultaneous additions, changes, and deletions to the database. All commercial data-driven Web applications use client/server databases.
Since version 1.0, Access has had the capability to connect to client/server databases by linking their tables to an Access database. Linking lets you treat client/server tables almost as if they were native Access tables. Linking uses Microsoft’s widely accepted Open Database Connectivity (ODBC) standard, and Access 2007 includes an ODBC driver for SQL Server and Oracle databases. You can purchase licenses for ODBC drivers that support other Unix or Windows RDBMSs, such as Sybase or Informix, from the database supplier or third parties. Chapter 19, “Linking Access Front-Ends to Access and Client/Server Tables,” describes the process of linking Access and Microsoft SQL Server 2005 databases. Although Chapter 19 uses SQL Server for its examples, the linking procedure is the same for—or at least similar to—other client/server RDBMSs.
Note – Prior to Access 2000, Jet was Access’s standard database engine, so the terms Access database and Jet database were interchangeable. Microsoft considered SQL Server to be its strategic RDBMS for Access 2000 and 2003. Strategic means that SQL Server gets continuing development funds and Jet doesn’t. Jet 4.0, which was included with Access 2003 and is a part of the Windows XP and later operating systems, is the final version and is headed toward retirement.
Microsoft’s Access team decided to enhance Jet 4.0 with the new features described in Chapter 1, “Access 2007 for Access 200x Users: What’s New,” change the file extension from .mdb to .accdb, and drop all references to Jet. To reflect this change, this edition uses the terms Access database and SQL Server database. Unless otherwise noted, SQL Server refers to all SQL Server 2005 editions except the Compact Edition 3.1.
Access data projects (ADP) and the Microsoft SQL Server 2005 Express Edition combine to make Access 2007 a versatile tool for designing and testing client/server databases, and creating advanced data entry and reporting applications. You can start with a conventional Access database and later use Access’s Upsizing Wizard to convert the .mdb file(s) to an .adp file that holds application objects and an SQL Server 2005 back-end database. Access 2007’s Upsizing Wizard has incorporated many improvements to the Access 2000 and earlier Wizard versions, but Access 2007’s Wizard is the same as 2002’s. Despite the upgraded wizardry, you’re likely to need to make changes to queries to accommodate differences between Access and SQL Server’s SQL dialects.
→ For an example of differences between Access and SQL Server SQL syntax that affects the upsizing process, see “Displaying Data with Queries and Views.”