[ Pobierz całość w formacie PDF ]
.The process of using primary keys and foreign keys is how the relationships between the data aredefined in a relational database.I will go into greater detail on this subject in the next few days.SummaryThe most widely used and accepted database model is the relational model.The relational modelprovides great openness and flexibility.Applications in addition to a database's original applicationcan access the data.The database is sufficiently abstracted from the application so that the databaseand the application can be independently updated.A relational database consists of tables, which are arranged in columns and rows.Each column iscalled a field.Each row is called a record and is unique, based on some key field or fields.The recordsin the tables in a relational database are related to each other, based on key fields that are calledprimary and foreign keys.Q&AQ Does Visual Studio provide support for other database models or technologies inthe same way that it supports relational databases?A No.The database integration that you find inside Visual Studio is based on ODBC.ODBC is designed to work with relational databases only.Therefore, Visual Studio 6provides direct support of and integration with only relational database technology.Q What's the difference between Microsoft Access and Jet? A Jet is the name of the database engine portion of Microsoft Access.You can think ofMicrosoft Access as a user interface (UI) to the Jet database engine.The Jet databaseengine is also used in the Access ODBC driver.When you write a C++ application thatstores data in an Access MDB file, your application makes calls to the Access ODBCdriver, which calls the Jet engine, which talks to the MDB file.Q Can't I build a relational database by using a record manager such as Btrieve or adesktop database such as FoxPro?A You can build a set of tables that use primary and foreign keys to relate records to eachother, using Btrieve or FoxPro.However, with Btrieve and FoxPro, each table is storedin a separate file.Also, Btrieve and FoxPro make no effort to help you enforce relationalrules inside your database as a relational database server (and, to a certain extent,Microsoft Access) does.With Btrieve and FoxPro, you will likely end up with adatabase that is partly relational and partly your own model, which will be a handicap inthe future when you try to add new features or capabilities to your database.Q Can't I use a spreadsheet such as Microsoft Excel as a database?A Some spreadsheet applications do provide support for database-type functionality.However, this functionality merely consists of storing rows and columns of data in amanner akin to a single table in a relational database.Spreadsheets provide no relationalcapabilities.Some spreadsheets, such as Microsoft Excel, do enable users to obtain datafrom relational databases and analyze that data inside the spreadsheet.The data must beformatted as a single table of data, however.Q With all the overhead of a relational database, isn't a relational database going tobe slow when compared to a lean and mean database that I create myself in C++ orcompared to a record manager?A A desktop database such as Microsoft Access will probably perform much faster thanany database you can write yourself.A relational database server, with its capability totake full advantage of multiprocessor servers and modern disk subsystems, willoutperform record managers in handling large quantities of data.WorkshopThe Workshop quiz questions test your understanding of today's material.(The answers appear inAppendix F, "Answers.") The exercises encourage you to apply the information you learned today toreal-life situations.Quiz1.Which editions of Visual C++ enable viewing and editing data from relational databases insideVisual Studio?2.What is a DSN?3.What gives a database its value and why?4.What is the fundamental requirement for records in a relational database?5.What mechanism is used to relate records in different tables to one another? Exercises1.Open the Orders table in the database project you created today.Note the foreign keys thatappear in the table.Open the Customers and Products tables and see primary keys forcustomers and products.Try to change one of the foreign key values, such as a customernumber, to a number that doesn't exist as a primary key.What happens? Does the database helpenforce the integrity of the data?2.Open the Orders table in the database project you created today.Try to change one of theorder numbers in the table by typing in letters for the contents of the field.When you move thecursor off that record, what happens? Does the database validate the data type you tried toenter? (You can press Esc to abort the edit.)© Copyright, Sams Publishing.All rights reserved. Teach Yourself Database Programmingwith Visual C++ 6 in 21 daysDay 3Retrieving Data Through StructuredQuery Language (SQL)Structured Query LanguageThe SQL SELECT StatementThe ORDER BY ClauseThe WHERE ClauseSQL JoinsSQL SubqueriesResultsets and CursorsSummaryQ&AWorkshopQuizExercisesToday you will learn how to capture data from relational databases by using Structured QueryLanguage (SQL).SQL is a powerful language designed specifically for manipulating data [ Pobierz caÅ‚ość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • czarkowski.pev.pl
  •