Universal Database (netDB2) Introductory GuideAlter And Drop StatementsIn order to modify the schema of an existing relation the statement of "Alter" is used. These modifications are done by a statement that begins with a keyword ALTER TABLE and the name of the relation.
In this case the customer has 6 attributes, in the actual relation, tuples would now all have components phone, but since it has been added later, the value of each of these components would be NULL. We can set a default value of added tuples by:
PRIMARY KEY:
Now there can be 2 tuples of the same ssn.
DROP A TABLE:
A constraint can be dropped from the table scheme for e.g., if one wants to remove the primary key from the table customer then:
As a result of the SQL statement, the following statement is possible.
Moreover, if any other table had been used the "drop" attribute as the foriegn key, then the referential key constraint on the second table would be automatically removed.
Would'nt have allowed entries in cust with cust-id's, which were not present in customer(ssn). But after the customer key had been dropped from the customer table, it would be possible to have entries in the cust table, with custid which are not ssn attributes for customer.
Once the primary key is dropped from the table, all the referential integrity constraints are also dropped and they have to be explicitly added on. |