Page 495 - Microsoft Office Excel 2003 Programming Inside Out
P. 495

Excel and the Structured Query Language


                             Note  Depending on whom you talk to, you’ll hear the acronym SQL pronounced either as
                             the word sequel or as a series of letters (S-Q-L). Both pronunciations are correct, but the
                             first came about because the Structured Query Language used to be known as the
                             Structured English Query Language.


                             Inside Out

                             Database Design and Administration
                             Designing and using databases can be a complex task. Most organizations have one or
                             more individuals that are responsible for the database system. This is especially true if you
                             are using a high-performance database such as Microsoft SQL Server, Oracle, or DB2. If
                             you are not sure how these databases work in your organization, look for the individual
                             called the database administrator. The database administrator should be able to answer
                             many questions that apply to your specific environment.
                             In situations where you are dealing with simple database systems such as Access, you
                             might not have a database administrator. In these cases, you might want to talk to the per-
                             son who wrote the programs for the database. This individual should be able to provide you
                             information, such as connection strings, that you need to open the database from Excel.
                             If you want to design your own database, keep in mind the following: KISS (Keep It Simple
                             Stupid) and SMILE (Simple Makes It Lots Easier). If you have only a few hundred pieces of
                             data, consider keeping all the data in a set of Excel worksheets. You might find it easier to
                             maintain than building a real database.
                                                                                                             Chapter 22
                             If you really believe that you need a database, take some time and read some books that
                             provide a good introduction to databases such as Microsoft Office Access Inside Out by
                             John L. Viescas (Microsoft Press, 2003). Just keep in mind that it’s very easy to design a
                             database that’s so complex to use that it really doesn’t address your original needs.



                    Database Keys
                             A database key is a way to identify a set of rows in a table. The primary key for a table is a way
                             to uniquely identify a particular row in the table. Often the primary key is a single column,
                             such as CustomerId or EmployeeId, which could uniquely identify a row in the Customers or
                             Employees tables. However, it’s desirable that the primary key for a table can span multiple
                             columns. In other words, the combination of OrderNumber and ItemNumber uniquely iden­
                             tifies a particular item purchased within an order.
                             A secondary key is different from the primary key in that it need not uniquely identify a single
                             row. In fact, secondary keys are useful for locating groups of rows that have something in
                             common, such as all the customers in a particular city or all the orders that were placed on
                             the same date.




                                                                                                       469
                                                                        Part 6:  Excel and the Outside World: Collaborating Made Easy
   490   491   492   493   494   495   496   497   498   499   500