Skip to main content


Showing posts from March, 2011

Databases - Basics

In the previous post (Databases Introduction)  we looked at different types of databases and simple concepts of tables. In this section, we will look at some basics of databases- tables, inner joins and outer joins. The syntax of SQL used here is for Oracle. However, it is very similar in all other databases such as MySQL, MS SQLServer, Postgres, etc..


We will create two tables by using the SQL statements below:
create table customer (cust_id number(4,0) not null, customer_name varchar2(60) not null);create table invoice (invoice_id number(4) not null, cust_id number(4) not null , invoice_total number(10,2) default 0.00, paid_ind char(1)); In the first SQL we create the table called Customer with the column names cust_id and customer_name. Observe that we do not want to store null values in each of the columns in the customer table.

In the second SQL we create the table invoice, which has its columns and also the cust_id column from the customer table. This is how we delegate th…