1 chapter 2: creating and modifying database objects
TRANSCRIPT
![Page 1: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/1.jpg)
1
Enhanced Guide to Enhanced Guide to Oracle8iOracle8i
Chapter 2:Creating and Modifying Database Objects
![Page 2: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/2.jpg)
2
Database Objects An Oracle database consists of
multiple user accounts Each user account owns database
objects Tables Views Stored programs Etc.
![Page 3: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/3.jpg)
3
Query: command to perform operation on database object Create Modify View Delete
Structured Query Language (SQL) Standard query language for
relational databases
Database Queries
![Page 4: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/4.jpg)
4
SQL Command Types Data Definition Language (DDL)
Used to create and modify the structure of database objects
Data Manipulation Language (DML) Used to insert, update, delete, and
view database data
![Page 5: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/5.jpg)
5
DDL Commands Used to create and modify the
structure of database objects CREATE ALTER DROP
DDL commands execute as soon as they are issued, and do not need to be explicitly saved
![Page 6: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/6.jpg)
6
DML Commands Used to insert, view, and modify
database data INSERT UPDATE DELETE SELECT
DML commands need to be explicitly saved or rolled back COMMIT ROLLBACK
![Page 7: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/7.jpg)
7
User Accounts Each Oracle database user has a
user schema Area in the database where the user’s
database objects are stored Identified by a unique username and
protected by a password Each user schema is granted
specific privileges
![Page 8: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/8.jpg)
8
Types of Database Privileges
System Privileges Control the operations that the user can
perform within the database 1.Connecting to the database, 2.creating new tables,
3.shutting down the database, etc. Object Privileges
Granted on individual database objects Controls operations that a user can perform on
a specific object (insert data, delete data, etc.) When you create an object in your user
schema, you can then grant object privileges on that object to other database users
![Page 9: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/9.jpg)
9
Oracle Naming Standard Oracle database objects must
adhere to the Oracle Naming Standard 1 to 30 characters long Must begin with a character Can contain characters, numbers, and
the symbols $, _, and #
![Page 10: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/10.jpg)
10
Creating New User Accounts Done by DBA Syntax:CREATE username IDENTIFIED BY password;
![Page 11: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/11.jpg)
11
Example Oracle System Privileges
PrivilegePrivilege LeveLevell
PurposePurpose
CREATE SESSION User Connecting to database
CREATE TABLE User Creating tables in current user schema
DROP TABLE User Dropping tables in current user schema.
UNLIMITED TABLESPACE
User Allows user to create schema objects using as much space as needed
CREATE USER DBA Creating new users
GRANT ANY PRIVILEGE DBA Granting system privileges to users
CREATE ANY TABLE DBA Creating tables in any user schema
DROP ANY TABLE DBA Dropping tables in any user schema
![Page 12: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/12.jpg)
12
Granting System Privileges Done by DBA Syntax:
GRANT privilege1, privilege2, … TO username;
![Page 13: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/13.jpg)
13
Database Roles Role is a database object that can
be assigned system privileges Role is then assigned to a user,
and the user inherits the role’s privileges
Used to easily assign groups of related privileges to users
![Page 14: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/14.jpg)
14
1. Creating Roles Syntax:CREATE ROLE role_name;
![Page 15: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/15.jpg)
15
2.Assigning Privileges to a Role
Syntax:GRANT privilege1, privilege2, …
TO role_name;
![Page 16: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/16.jpg)
16
3.Assigning a Role to a User Syntax:GRANT role_name TO user_name;
![Page 17: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/17.jpg)
17
Revoking System Privileges Syntax:REVOKE privilege1, privilege2, …
FROM username;
![Page 18: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/18.jpg)
18
Administering System Privileges
To be able to grant system privileges to other users, a user account must have been granted the privilege WITH ADMIN OPTION
![Page 19: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/19.jpg)
19
T T
T
T T
T
DBA_User (System/ocmt)
User_2User_1
![Page 20: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/20.jpg)
20
To create a table, you must specify: Table name Field names Field data types Field sizes Constraints
Defining Database Tables
![Page 21: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/21.jpg)
21
Must follow the Oracle Naming Standard
Each table in a user schema must have a unique name within that user schema
Each field in a table must have a unique name within that table
Table and Field Names
![Page 22: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/22.jpg)
22
Data type: specifies type of data stored in a field Date, character, number, etc.
Uses Error checking Efficient use of storage space
Oracle Data Types
![Page 23: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/23.jpg)
23
VARCHAR2 Variable-length character strings Maximum of 4,000 characters Must specify maximum width
allowed No trailing blank spaces are
added
Example declaration:student_name VARCHAR2(30)
Oracle Character Data Types
![Page 24: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/24.jpg)
24
CHAR Fixed-length character data Maximum size 2000 characters Must specify maximum width allowed Adds trailing blank spaces to pad
width
Example declaration:student_gender CHAR(1)
Character Data Types
![Page 25: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/25.jpg)
25
NCHAR Supports 16-digit binary
character codes Used for alternate alphabets
Character Data Types
![Page 26: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/26.jpg)
26
NUMBER stores values between 10-130 and 10126
General declaration format:variable_name NUMBER(precision, scale)
Number Data Type
![Page 27: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/27.jpg)
27
Number type (integer, fixed point, floating point) specified by precision and scale Precision: total number of digits
on either side of the decimal point
Scale: number of digits to right of decimal point
NUMBER Data Types
![Page 28: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/28.jpg)
28
Whole number with no digits to right of decimal point
Precision is maximum width Scale is omitted
Sample declaration:s_age NUMBER (2)
Integer Numbers
![Page 29: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/29.jpg)
29
Contain a specific number of decimal places
Precision is maximum width Scale is number of decimal
places
Sample declaration:item_price NUMBER(5, 2)
Fixed Point Numbers
![Page 30: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/30.jpg)
30
Contain a variable number of decimal places
Precision and scale are omitted
Sample declaration:s_GPA NUMBER
Floating Point Numbers
![Page 31: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/31.jpg)
31
DATE Stores dates from 1/1/4712 BC to
12/31/4712 AD Stores both a date and time
component Default date format:
DD-MON-YY HH:MI:SS AM example: 05-JUN-03 12:00:00 AM
Sample declaration:s_dob DATE
Date Date Type
![Page 32: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/32.jpg)
32
If no time value is given when a new date is inserted, default value is 12:00:00 AM
If no date value is given when a new time is inserted, default date is first day of current month
Specifying Date and Time Values
![Page 33: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/33.jpg)
33
Large Object (LOB) Data Types Binary Large Object (BLOB)
Stores up to 4 GB of binary data Character Large Object (CLOB)
Stores up to 4 GB of character data BFILE
Stores a reference to a binary file maintained in the operating system
NCLOB Character LOB that supports 16-bit
character code
![Page 34: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/34.jpg)
34
Declaring LOB Data Fields Item size is not specified
Examples:item_image BLOB
item_image BFILE
![Page 35: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/35.jpg)
35
Syntax:CREATE TABLE table_name
( fieldname1 datatype, fieldname2 datatype, …); Example:CREATE TABLE my_students( s_id NUMBER(6),
s_name VARCHAR2(30), s_dob DATE, s_class CHAR(2));
Creating a Database Table
![Page 36: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/36.jpg)
36
Constraints Rules that restrict the values that
can be inserted into a field Types of constraints
Integrity: define primary and foreign keys
Value: specify values or ranges of values that can be inserted
![Page 37: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/37.jpg)
37
Constraint Levels Table constraint
Restricts the value of a field with respect to all other table records
Example: primary key value must be unique for each record
Column constraint Restricts values in a specific column Example: values in an S_GENDER
field must be ‘M’ or ‘F’
![Page 38: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/38.jpg)
38
It is an Internal name used by DBMS to identify the constraint
Each constraint name in a user schema must be unique
If you do not name a constraint, the system will automatically generate an unintuitive name
Constraint Names
![Page 39: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/39.jpg)
39
Constraint naming convention:1.tablename_2.fieldname_3.constraintID
Constraint ID values: Primary key: pk Foreign key: fk Check condition: cc Not NULL: nn Unique: uk
Example constraint name:1.my_students_2.s_id_3.pk
Constraint Names
![Page 40: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/40.jpg)
Nationality_nat_no_Pk
40
![Page 41: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/41.jpg)
41
Table-level Defining a primary key:
CONSTRAINT constraint_name PRIMARY KEY
Example:s_id NUMBER(6)
CONSTRAINT student_s_id_pk PRIMARY KEY
Primary Key Constraints
![Page 42: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/42.jpg)
42
Can be defined when field is declared
Primary Key Constraints
![Page 43: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/43.jpg)
43
Can also be defined after all table field definitions are completed
Primary Key Constraints
![Page 44: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/44.jpg)
44
Syntax:CONSTRAINT constraint_name
PRIMARY KEY (field1, field2)
Must be defined after fields that compose key are defined
Composite Primary Keys
![Page 45: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/45.jpg)
H.W: What is the default value for
“Number” Data type?? Means: “If the user did not specify the size
of the field”
45
![Page 46: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/46.jpg)
46
Table-level Can only be defined after field is
defined as a primary key in another table
Syntax:CONSTRAINT constraint_name
REFERENCES primary_key_table_name (field_name)
Foreign Key Constraints
![Page 47: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/47.jpg)
47
Can be defined when field is declared
Foreign Key Constraints
![Page 48: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/48.jpg)
48
Can also be defined after all table field definitions are completed
Foreign Key Constraints
![Page 49: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/49.jpg)
49
Column-level Restricts data values that can be
inserted in a field In general, avoid value constraints
because they make the database very inflexible
Value Constraints
![Page 50: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/50.jpg)
50
Check condition: restricts to specific values Example: s_gender (M or F)CONSTRAINT my_students_s_gender_ccCHECK (s_gender = ‘M’) OR (s_gender = ‘F’)
Not NULL: specifies that a field cannot be NULL Example: CONSTRAINT my_students_s_dob_nnNOT NULL
Types of Value Constraints
![Page 51: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/51.jpg)
51
Default: specifies a default value that is inserted automatically Example:s_state CHAR(2) DEFAULT ‘WI’
Unique Table constraint Specifies that a non-primary key field must have a
unique value CONSTRAINT consultant_c_email_uk UNIQUE (c_email)
Types of Value Constraints
![Page 52: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/52.jpg)
52
Oracle SQL command line utility for issuing SQL commands
Starting SQL*Plus
SQL*Plus
![Page 53: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/53.jpg)
53
All commands must be terminated with a semicolon
Use a text editor and copy and paste commands
Character data is case sensitive and must be in single quotes‘M’
‘Sarah’
Using SQL*Plus
![Page 54: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/54.jpg)
54
Type exit at SQL> promptor
Click Close button on SQL*Plus window
Exiting SQL*Plus
![Page 55: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/55.jpg)
55
Ora.hlp file Oracle Technology Network
(OTN) http://otn.oracle.com
Oracle Help Resources
![Page 56: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/56.jpg)
56
Viewing a table’s structureDESCRIBE table_name;
Viewing Table Information
![Page 57: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/57.jpg)
57
Oracle Data Dictionary Contains tables that describe the
database structure Is in the SYSTEM user schema
Is automatically updated as users create and modify tables Cannot be updated directly
Contains views that allow users to retrieve information about the database structure
![Page 58: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/58.jpg)
58
Data Dictionary Views Views present data in different
formats depending on the privileges of the user USER: shows all objects belonging to
the current user ALL: shows all objects belonging to the
current user, as well as objects current user has privileges to manipulate
DBA: allows users with DBA privileges to view objects of all database users
![Page 59: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/59.jpg)
59
Querying the Data Dictionary Views
Syntax:SELECT field1, field2, …
FROM privilege_viewname;
![Page 60: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/60.jpg)
60
Summary of Oracle Data Dictionary ViewsOBJECTS All database objects
TABLES Database tables
INDEXES Table indexes created to improve query performance
VIEWS Database views
SEQUENCES Sequences created to automatically generate surrogate key values
USERS Database users
CONSTRAINTS Table constraints
CONS_CONSTRAINTS
Table columns that have constraints
IND_COLUMNS Indexed columns
TAB_COLUMNS All table columns
![Page 61: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/61.jpg)
61
Unrestricted actions Renaming tables Adding new columns Increasing column sizes Dropping columns Dropping constraints
Modifying Tables
![Page 62: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/62.jpg)
62
Restricted actions Dropping tables
Only allowed if table does not contain any fields that are referenced as foreign keys, or if foreign key constraints are dropped
Changing a column’s data specification Only allowed if existing data is compatible with
new data specification Decreasing column sizes
Only allowed if column does not contain any data Adding constraints
Only allowed if existing data meets requirements of new constraint
Modifying Tables
![Page 63: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/63.jpg)
63
Altering Tables Adding a new field:ALTER TABLE tablename
ADD (fieldname field_specification);
![Page 64: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/64.jpg)
64
Altering Tables Modifying an existing field:ALTER TABLE tablename
MODIFY (fieldname new_field_specification);
![Page 65: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/65.jpg)
65
Altering Tables Deleting an existing field:ALTER TABLE tablename
DROP COLUMN fieldname;
![Page 66: 1 Chapter 2: Creating and Modifying Database Objects](https://reader035.vdocument.in/reader035/viewer/2022062217/5697bfb71a28abf838c9e8e3/html5/thumbnails/66.jpg)
66
Deleting Tables Syntax to delete table if no table
fields are referenced as foreign keys:DROP TABLE tablename;
Syntax to delete table and constraints if table contains fields that are referenced as foreign keys:
DROP TABLE tablename CASCADE CONSTRAINTS;