Subject RE: [ib-support] Metadata
Author Helen Borrie
At 12:32 PM 11/02/2003 +1000, you wrote:
>I have a vague idea about metadata.

Data is...well, data.
Metadata is "data about data". It's a description of all of the objects in
a database - size, shape, attributes, constraints, etc. "Metadata" is a
plural noun, even though people habitually use it as if it were
singular. "Schema" (a singular noun) is often used interchangeably with
"metadata" to mean the same thing...some databases (not Firebird) implement
CREATE SCHEMA and ALTER SCHEMA statements, i.e. they formalise the concept
in their particular flavour of SQL.

>It is a description of the database.
>ie this table has this field which is txt and 5 characters long, indexed,
>and mandatory.

The term "metadata" is also often used loosely to refer to the DDL (Data
Definition Language) statements needed to create or alter database objects...

The "metadata" for this object in standard SQL and Firebird would be:



After that, you could get your index for Field in one of three ways (but
don't do it in more than one of these ways):

This makes Field the Primary Key and creates a unique index for it.


As above, but Field is not made the Primary Key.

ON ATABLE (Field);

Similar to above.
An index can also be non-unique (omit the keyword) and can involve multiple
columns. Various attributes can be applied to indexes (or indices if you
want to be strict about the Latin!)

>I am under the impression that you can create a database using it, as
>opposed to admin tools.

Wrong impression I think. Everything about data definition (like everything
else) boils down to SQL query statements. Data definition statements all
start with the keyword CREATE, ALTER, RECREATE, DROP or SET. Some admin
tools construct the SQL for you behind the scenes. Others provide an
interface for you to submit your own query statements. Any self-respecting
admin tool for Firebird should provide the capability to run DDL scripts,
which are batches of metadata (DDL) statements.

>And this is what I want to do.
>But I haven't a clue how.

Start by reading the manuals. The (free) IB 6 beta manuals will leave you
pretty clueless if you are already clueless. They tell you how to use the
tools and they tell you about the SQL statement syntax, but they don't tell
you step-by-step how to begin constructing a database.

If you are a student, you can get the IBPhoenix CD for $99. On it are the
Firebird manuals. "Using Firebird" provides the information you need about
constructing databases from scratch, developing and maintaining them.

>How do I know what metadata to use.
>Is metadata different for different RDBMS?

Generally, yes. There are SQL standards, which Firebird and InterBase
follow very closely. Then there is Microsoft, which uses SQL syntax
invented by goblins. In between are the rest. Sybase is worse than MSSQL,
Oracle is fairly close to Fb/IB. Any context-neutral book you buy re using
SQL will be usable for Firebird. Oracle books will be quite handy. MSSQL
or Access books will be useless unless you have a need for ballast in your

For starting out, SQL for Dummies Second Edition covers the low ground
rather well, and uses InterBase SQL for the examples. At the time it was
written, Firebird didn't exist, but Firebird hasn't changed the existing
language, only added to it.

There are no standards for the server programming language - each RDBMS has
its own SQL subset for that. In Firebird it is know as PSQL (Programming
SQL). Oracle's language is called P/L. Microsoft applies a new name (such
as Charlie Paperclip) to its language each time it releases a new
bugfix. << slight exaggeration >>.

>or is it standard.

Yes and no.