Databases Reference
In-Depth Information
DROP TABLE
Use the DROP TABLE command to delete a table, as shown in Figure B-8.
350
Clause
Description
Required?
DROP INDEX table name
Indicates the name of table to be dropped.
Yes
FIGURE B-8 DROP TABLE command
The following DROP TABLE command deletes the table named SmallCust:
DROP TABLE SmallCust
;
GRANT
Use the GRANT statement to grant privileges to a user. Figure B-9 describes the GRANT statement.
Clause
Description
Required?
GRANT privilege
Indicates the type of privilege(s) to be granted.
Yes
ON database object
Indicates the database object(s) to which the privilege(s) pertain.
Yes
TO user name
Indicates the user(s) to whom the privilege(s) are to be granted.
Yes
FIGURE B-9 GRANT statement
The following GRANT statement grants the user named Johnson the privilege of selecting rows from the
Rep table:
GRANT SELECT ON Rep TO Johnson
;
INSERT
Use the INSERT command and the VALUES clause to insert a row into a table by specifying the values for each
of the columns. As shown in Figure B-10, you must indicate the table into which to insert the values and
then list the values to insert in parentheses.
Clause
Description
Required?
INSERT INTO table name
Indicates the name of the table into which the row will be inserted.
Yes
VALUES (values list)
Indicates the values for each of the columns on the new row.
Yes
FIGURE B-10
INSERT command
The following INSERT command inserts the values shown in parentheses as a new row in the Rep table:
INSERT INTO Rep
VALUES
('16','Rands','Sharon','826 Raymond','Altonville','FL','32543',0.00,0.05)
;
I NTEGRITY
You can use the ALTER TABLE command with an appropriate CHECK, PRIMARY KEY, or FOREIGN KEY
clause to specify integrity. Figure B-11 describes the ALTER TABLE command for specifying integrity.
 
 
Search WWH ::




Custom Search