How to Use the ddl Statement of jetsql to establish tables and relationships? Microsoft's Access includes DataDefinitionLanguage (DDL) to create and Delete tables and relationships. Of course, this can also be solved using DAO. The following is an example: Use CreateTable of DDL to create a table Table1. The primary key is an automatically numbered field, and the other is a text field with a length of 10. CRES
How to Use the ddl Statement of jetsql to establish tables and relationships? Microsoft's Access includes DataDefinitionLanguage (DDL) to create and Delete tables and relationships. Of course, this can also be solved using DAO. The following is an example: Use CreateTable of DDL to create a table Table1. The primary key is an automatically numbered field, and the other is a text field with a length of 10. CRES
How to Use the ddl Statement of jetsql to establish tables and relationships?
Microsoft's Access includes DataDefinitionLanguage (DDL) to create and Delete tables and relationships. Of course, this can also be solved using DAO.
The following is an example:
Use CreateTable of DDL to create a table Table1. The primary key is an automatic number field, and the other is a text field with a length of 10.
CREATETABLETable1 (IdCOUNTERCONSTRAINTPrimaryKeyPRIMARYKEY, MyTextTEXT (10 ))
Create a table named Table2 that contains two fields. The field id is a long integer and the field MyText is text.
CREATETABLETable2 (IdLONG, MyTextTEXT)
Use the following statement to create a one-to-multiple relationship between Table1 and Table2:
Altertable2addconstraintrelation1foreignkey ([Id]) REFERENCESTable1 ([Id])
Use the following statement to delete a link:
ALTERTABLETable2DROPCONSTRAINTRelation1
To delete table 1, use the following statement:
DROPTABLETable1
Set a field as the primary key
ALTERTABLE Table 1 ALTERCOLUMN [id] COUNTERCONSTRAINTMyPrimaryKeyPRIMARYKEY
Add a field MySalary
AltertableAAAaddCOLUMNMySalaryCURRENCY
Delete a field MySalary
AltertableAAAdropCOLUMNMySalary