Teach yourself Database Programming
with Visual C++ 6 in 21 days


Week 1...
        In Review


The first day's lesson examines the different database technologies, including OLE structured storage, record managers (such as Btrieve), desktop databases (such as FoxPro and Access), object databases, and relational database servers (such as Oracle and SQL Server).

The lesson on Day 2 explains that the most widely used and accepted database model is the relational model. A relational database consists of tables, which are arranged in columns and rows. Each column is called a field. Each row is called a record and is unique, based on some key field or fields. The records in the tables in a relational database are related to each other, based on key fields that are called primary and foreign keys.

In Day 3's lesson, you learned that SQL is a language that excels at manipulating data. You learned how to issue SELECT queries to retrieve records from a single table in a relational database. You learned how to perform joins to retrieve records from multiple tables. You learned how to use sub-queries in SQL to obtain information that requires a large quantity of procedural code to retrieve. Last, you learned that cursors are a mechanism that enables record-at-a-time navigation through a result set.

On Day 4, you learned that to access a database from C++, it's necessary to use a database API. Several database APIs are available to C++ developers. The future of all data access in Microsoft Windows is OLE DB. The easiest way to use OLE DB is to use ADO. ADO provides an object model that encapsulates the process of communicating with databases from within C++ programs, as well as from other programming languages.

On Day 5, you learned two methods for manipulating records in a database. You learned how to manipulate records from C++ code by using the ADO Recordset member functions to insert, update, and delete records. You also learned how to manipulate records from SQL, using the INSERT, UPDATE, and DELETE statements.

On Day 6, you learned how to harness the power of relational database servers. You saw how the SQL INSERT, UPDATE, and DELETE statements can be used to process many records at a time. You also learned about stored procedures and how to call them, using ADO Command objects.

You wrapped up your first week of study by learning how the process of designing a relational database can be made easier by using the intuition-based R2D2s and the science-based normal forms. The process of normalizing your database typically involves separating tables in your database into more specialized tables. Use SQL Data Definition Language (DDL) to build the schema of your database, which includes tables, indexes, and constraints. Indexes can enable better query performance. Constraints can help ensure the integrity of the data inside the database.


© Copyright, Sams Publishing. All rights reserved.