Saturday, December 19, 2009

Dataphor: How to create a table with a primary key

Creating a table in Dataphor is easy:

create table Debt
{
    ID : Integer,

    key { ID },
};



That translates (when using MSSQL as storage) into (if we ask MSSQL to provide us with the SQL DDL):



CREATE TABLE [dbo].[Debt](
    [ID] [int] NOT NULL

)

 

CREATE UNIQUE CLUSTERED INDEX [UIDX_Debt_ID] ON [dbo].[Debt]
(
    [ID] ASC

)



It is important to note that D4 does not have the concept of a primary key, and that the “key” keyword results in a unique index, that while for all uses and purposes can work as a primary key, it is not recognized as such by MSSQL. It is possible to have several different “keys” in a Dataphor table.

No comments:

Requirements Analysis: Negative Space

A while ago, I was part of a team working on a crucial project. We were confident, relying heavily on our detailed plans and clear-cut requi...