This section provides the process for creating the sample
tables that later sections use to describe join features.
Follow the procedure in the following table to create two sample
tables.
Table 1. Creating sample tables to illustrate
join features
Step |
Action |
1 |
Enter the following command to create the sample table cows_one: CREATE TABLE cows_one (cnumber int, cbreed varchar(20));
|
2 |
Insert the following records into the table: INSERT INTO cows_one VALUES (1,'Holstein');
INSERT INTO cows_one VALUES (2,'Guernsey');
INSERT INTO cows_one VALUES (3,'Angus');
|
3 |
Do a select to see what the table looks like: system(admin)=> SELECT * FROM cows_one;
cnumber | cbreed
--------+----------
1 | Holstein
2 | Guernsey
3 | Angus
(3 rows)
|
4 |
Create another table named cows_two: CREATE TABLE cows_two (cnumber int, breeds varchar(20));
|
5 |
Insert records into the table: INSERT INTO cows_two VALUES (2,'Jersey');
INSERT INTO cows_two VALUES (3,'Brown Swiss');
INSERT INTO cows_two VALUES (4,'Ayrshire');
|
6 |
Do a select to display the table: system(admin)=> SELECT * FROM cows_two;
cnumber | breeds
-----------+---------
2 | Jersey
3 | Brown Swiss
4 | Ayrshire
(3 rows)
|