Database Articles

  Home arrow Database Articles arrow Page 2 - Intro to Databases
DATABASE ARTICLES

Intro to Databases
By: lig
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2005-10-18

    Table of Contents:
  • Intro to Databases
  • Database Basics
  • SQL - Structured Query Language
  • Working with Databases
  • Connecting to the database and selecting the database
  • Sending a Query to the Database and Getting the Results
  • Freeing the Results and Closing Down
  • Conclusion

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Intro to Databases - Database Basics


    (Page 2 of 8 )

    Terminology

    The first thing you have to learn is a little bit of database terminology and concepts. Don't worry it isn't hard or even very confusing (hopefully).

    Ok from the big to the small. A "database" is a collection of related "tables". A "table" is a collection of related "records". A "record" is a collection of related "fields". And a "field" is a collection of related pieces of information (the stuff we are after when we work with databases). So:

    Are you with me so far?

    But what about cells, columns and rows? That is what everyone talks about. A cell is a specific piece of information (again the stuff we are after when we use databases). Examples: John, 96915, programmer. A column is a collection of specific types of information. Examples: A first name, a zip code, a job title. A row is a collection of related columns. Hmmm - this is sounding familiar.

    Database terminology for whatever reason uses multiple names for the same things at times. A record is a row, a column is a field (it is also sometimes called an attribute), and a cell is a piece of information (occasionally called data though technically it isn't).

    Concepts

    OK - now for a little more information and concepts about tables. Each table is required to have a way to uniquely identify each record in it. This allows one record's information to be accessed amidst the thousands of other records. The field (or combination of fields) that hold the unique identifier is called the primary key.

    When considering what field to declare as a table's primary key, you must keep in mind if the field will EVER possibly have 2 records with the same entry or if the field will ever change. A person's name typically does not work since there are many John Browns in the world. An address may eventually be changed. A social security number or generated account number may be a better option as a table's primary key.

    Next major concept - indexes. An index allows a user to quickly find the information they are looking for. Think of it like a book index - look up something and find exactly where it is in the book. A primary key is an index (usually made automatically by the database). A table can have as many indexes as you want - to help you find the information you seek. Just remember that the more indexes a table has the more space that is being used by those indexes.

    One more concept - the information contained in a cell usually is as granular as possible. What does that mean? Basically it means that you break down the data into its smallest pieces. Well it is easiest to show an example rather then explain.

    You have a person's name. You can save it in the database attribute NAME as "Lennon, Luke M." or even "Luke M. Lennon". But what if for some reason you want to know something about the Lennon Family? Now you will have to manipulate the strings to isolate the last name. A better way to do it... Instead of having 1 field called NAME we should have 3 fields named FIRST_NAME, MIDDLE_NAME, and LAST_NAME. This will allow a person's name to be broken down into its smallest parts. Making sense?

    The last basic concept that I believe is important to know, is that all data held in the database is kept in a random order. This includes the ordering of the fields (AKA columns) and the order of the information inserted or returned (rows). In a database there is no difference if the columns are output as "Name Zip Job" or "Job Name Zip". To the database they are the same thing. The database also does not care if the results (generated by a query) positions the record containing "John" as first or 15th or last. We will later discuss a way to guarantee an output's ordering by using the databases computer language.

    More Database Articles Articles
    More By lig

    blog comments powered by Disqus

    DATABASE ARTICLES ARTICLES

    - Completing a Book Inventory Management System
    - Uploading Images for a Book Inventory Manage...
    - Finishing the Add Book Story for a Book Inve...
    - Integration Testing for a Book Inventory Man...
    - User Stories for a Book Inventory Management...
    - Unit Testing a Book Inventory Management Sys...
    - Testing a Book Inventory Management System
    - Implementing Models for a Book Inventory Man...
    - Book Inventory Application: Publishers and B...
    - Handling Publishers in a Book Inventory Mana...
    - Publisher Administration for Book Inventory ...
    - Book Inventory Management
    - Using the SQL Reference Manual
    - Using Oracle SQL Developer with SQL Statemen...
    - Fixing Errors with Oracle SQL Developer


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap