HPlogo ALLBASE/SQL Reference Manual: HP 9000 Computer Systems > Chapter 10 SQL Statements A - D

DROP TABLE

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The DROP TABLE statement deletes the specified table, including any hash structure or constraints associated with it, all indexes, views, and rules defined on the table, and all authorizations granted on the table.

Scope

ISQL or Application Programs

SQL Syntax

  DROP TABLE [Owner.]Tablename

Parameters

[Owner.]TableName

identifies the table to be dropped.

Description

  • The DROP TABLE statement may invalidate stored sections. Refer to the ALLBASE/SQL Database Administration Guide for additional information on section validation.

  • You cannot drop a table which has a primary or unique constraint referenced by a foreign key in another table. (You can, however, if the only foreign keys are within the same table.)

  • Any authorities used to authorize a foreign key on the table are released when the table is dropped.

Authorization

You can issue this statement if you have OWNER authority for the table or if you have DBA authority.

Example

This table is private by default.

   CREATE TABLE VendorPerf
               (OrderNumber  INTEGER  NOT NULL,
               ActualDelivDay  SMALLINT,
               ActualDelivMonth  SMALLINT,
               ActualDelivYear  SMALLINT,
               ActualDelivQty  SMALLINT
               Remarks  VARCHAR(60) )
            IN Miscellaneous
 
      CREATE UNIQUE INDEX VendorPerfIndex
                    ON VendorPerf
                       (OrderNumber)
 
   CREATE VIEW VendorPerfView
               (OrderNumber,
               ActualDelivQty,
               Remarks)
     AS SELECT OrderNumber,
               ActualDelivQty,
               Remarks
          FROM VendorPerf

Only the table creator and members of authorization group Warehse can update table VendorPerf.

   GRANT UPDATE ON VendorPerf TO Warehse

The table, the index, and the view are all deleted; and the grant is revoked.

   DROP TABLE VendorPerf
Feedback to webmaster