Working With Oracle on Windows: Part 2 - Databases (Page 2 of 7 )
Since this is only the second of my series, it is important to refresh your knowledge of SQL (i.e. Structured Query Language). As this series progresses the use of SQL will become more sophisticated. Don’t worry about it. You will be able to understand the code when that time comes.
In my last article, there were a number of people that did not quite understand the code. So, let’s start from the beginning. A database it quite useless without a table. Oracle 9i, which we should already have registered and installed, contains a feature called SQL*Plus.
You have now read the article and have understood how database is created. Create the database and startup an instance. There is nothing useful inside your database so far. A database may contain at least a table. The table will allow you to store the data in various fields. Well designed tables contain a field which is called a primary key. A primary key is a field in which is used to identify the record/s in the table.
Two important details about a primary key is that it can not be a null value (i.e. each field must contain a value) and it must have a unique value. This is important because the reason for a primary key is to uniquely identify each record. Imagine if someone had the same credit card number as you … yikes!!!
It is possible to have more than one primary key (i.e. a composite primary key) – like in a barcode – where there is three parts.
If you have more than one table and you wish to have the two tables related in some way you can by introducing a foreign key. A foreign key is a field in a table that is used to uniquely identify a record in another table. This introduces relationships between tables.