Here's an example:
Creates a table Table1 with the DDL create TABLE, the primary key is an AutoNumber field, and the other is a text field with a length of 10.
Copy Code code as follows:
CREATE TABLE Table1 (Id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY, MyText TEXT (10))
To build a table Table2 with two fields, the field ID is a long integer, and the field MyText is text
Copy Code code as follows:
CREATE TABLE Table2 (Id LONG, MyText TEXT)
Use the following statement to establish a one-to-many relationship between Table1 and Table2, cascade Update, Cascade Delete:
Copy Code code as follows:
ALTER TABLE Table2 ADD CONSTRAINT Relation1 FOREIGN KEY ([id]) REFERENCES Table1 ([id]) on UPDATE CASCADE on DELETE Cascad E
Delete a relationship with the following statement:
Copy Code code as follows:
ALTER TABLE Table2 DROP CONSTRAINT Relation1
Delete Table1 with the following statement:
Copy Code code as follows:
Set a field as the primary key
Copy Code code as follows:
ALTER TABLE 1 ALTER COLUMN [ID] COUNTER CONSTRAINT myprimarykey PRIMARY KEY
Add a field mysalary
Copy Code code as follows:
ALTER TABLE AAA add COLUMN mysalary CURRENCY
Delete a field mysalary
Copy Code code as follows:
ALTER TABLE AAA drop COLUMN mysalary