Database Basics
Links
1-a: How Does My Data Get Stored?How the data is stored in a database is probably much simpler than you might think. Databases use a series of Tables to store the data. A table simply refers to a two dimensional representation of your data using columns and rows. For example: |
|
1-b: How Do I Organize My Data?The next thing to understand about your table is the Primary Key. The Primary Key simply refers to a column in your table that is guaranteed unique. The Primary Key is then used for the purposes of indexing your table which makes it much more efficient to search, sort, link, etc. |
|
1-c: How Does All of This Relate?That's great. I have the people in one table and the newsletters in another table. How the heck am I supposed to know who is subscribed to what? This is the best part. This is where the Relational Database gets its name. Relational Database? You never mentioned that. |
|
2-a: What is a Data Type?Well, before we get started making a table there is one thing you need to understand first, Data Types. Data Types are pretty straight forward. They indicate the type of data that you are storing in a given table column. Amazing, huh? |
|
2-b: How Do I Create a Table?Creating a table is very easy. I'm going to show you 2 different ways to accomplish this task. The first will be to use a SQL statement. The second will be using a Graphical User Interface (GUI) tool. For our GUI example we are going to use Access since it is one of the most common databases out there today and, more importantly, it's already installed on my machine. ? |
|
2-c: How Do I Design a Table in a Database Tool?Now we'll use some pretty pictures to illustrate the process of creating a database and table in Access. There are many other DBMS's out there besides Access, so be sure to do a little homework and download some demos before you decide which DBMS is right for you. |
|
3-a: What is an INSERT statement?I'm sure that it's not hard to guess what the INSERT statement does. However, how it works will probably need a little explanation. In order to use INSERT you will need to learn about a couple of other important keywords, INTO and VALUES. |
|
3-b: What is an UPDATE statement?Again, it's pretty obvious what UPDATE does. Now that you have some data in your table you may want to update it. So, let's update John's email address. We know that John's ID number is 1. (We'll go through how you retrieve someone's ID number in Part 4.) So, let's update John's email address to |
|
3-c: Database FAQsSo, what's the deal with the semicolon? The semicolon at the end of a statement simply tells the DBMS that you are done with that statement and it should process it now. DBMSs can very greatly when it comes to designating the end of a statement so be sure to check your DBMS and see which one is right for you. |
|
4-a: What is a SELECT statement?So, what does SELECT do? Very simply, it tells the DBMS that you want to get some data out of the database. So, how does it work? SELECT can range from very simple to painfully complex. With SELECT there are a whole host of different options available to you that will allow you specify, calculate and arrange your data in an infinite number of ways. |
|