Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 1.4

COLUMN

Fun with SQL

Creating Tables and Data

Issue: 1.4 (February/March 2003)
Author: Paul Lefebvre
Author Bio: Paul Lefebvre is a software architect in Portland, Maine.
Article Description: No description available.
Article Length (in bytes): 5,276
Starting Page Number: 27
Article Number: 1413
Resource File(s):

Download Icon 1413.zip Updated: 2013-03-10 15:00:53

Related Link(s): None

Excerpt of article text...

Let's take the entities we created last time and turn them into tables. Once we do this we'll create these tables in a REALbasic database using SQL.

Mapping entities to tables is fairly straightforward. Typically, each entity becomes a table and each attribute becomes a column. You may have to do a few adjustments of table and column names to meet any restrictions of the specific database you are using. Also keep in mind that not every database has the exact same datatypes, so some changes may be necessary there as well.

Creating the SQL

Refer to the entities we created last time (see Figure 1). There's nothing fancy in the team entity (except that we'll use varchar instead of string), so its table create statement looks like this:

CREATE TABLE team (key integer not null, name varchar not null, coach varchar, primary key (key))

The key column is an artificial primary key. It is used in place of the team name so that we can more easily allow for changes to the team name after it has been used in other relationships.

...End of Excerpt. Please purchase the magazine to read the full article.