This is a category of SQL, where we look at the database, to see what it contains. Here's a simple example of that kind of SQL.
SELECT p_name FROM playerChoose the column "p_name", in the table "player".
As the database was normalized, among other things a big table was cut up, and became several small tables. With SELECT sentences we can glue the tables back together - this is called joins. Here's a simple example of that kind of SQL.
SELECT p_name, gender, text FROM player, message WHERE player.p_name = message.p_nameChoose the columns p_name, gender and text from the tables player and message. It should match, so that the messages are actually written by the player from the other table.
Notice that the "glue" is in the last line, where it is demanded, that the value from a column in one table should fit the value from a column in the other table - typically we say that the pimary key of one table should fit the foreign key in the other table.
Some of the trick of normalizing, and then joining, is that we can do things, that weren't possible otherwise. An unnormalized table could easily hold people and their children. With normalization and joins I can easily build on this, so I can show people, their children and their grandchildren.
Concept last updated: 18/05 2004.
- InterBase tutorial mm. (obl.) - s.37-62