Dbms chapter ii

8
Subject Name Code Credit Hours Database System COMP 219 3 Chapter II

description

 

Transcript of Dbms chapter ii

Page 1: Dbms chapter ii

Subject Name Code Credit HoursDatabase System COMP 219 3

Chapter II

Page 2: Dbms chapter ii

Subject Name Code Credit HoursDatabase System COMP 219 3

DBMS Languages:Types

Data Definition Language( DDL) Data Manipulation Language (DML)

storage definition language (SDL)

storage definition language (SDL)

Procedural DML

Non-Procedural DML

Page 3: Dbms chapter ii

Subject Name Code Credit HoursDatabase System COMP 219 3

DBMS Languages

– Used by the DBA and database designers to specify the conceptual schema of a database.

– In many DBMSs, the DDL is also used to define internal and external schemas (views).

– In some DBMSs, separate storage definition language (SDL) and view definition language (VDL) are used to define internal and external schemas.• SDL is typically realized via DBMS commands provided to the

DBA and database designers

Data Definition Language (DDL):

Page 4: Dbms chapter ii

Subject Name Code Credit HoursDatabase System COMP 219 3

Data Manipulation Language (DDL):

• Data Manipulation Language (DML):– Used to specify database retrievals and updates– DML commands (data sublanguage) can be embedded in a

general-purpose programming language (AKA host language), such as COBOL, C, C++, or Java.

– Alternatively, stand-alone DML commands can be applied directly (called a query language).

DBMS Languages

Page 5: Dbms chapter ii

Subject Name Code Credit HoursDatabase System COMP 219 3

Data Definition Language (DDL):

– Used by the DBA and database designers to specify the conceptual schema of a database.

– In many DBMSs, the DDL is also used to define internal and external schemas (views).

– In some DBMSs, separate storage definition language (SDL) and view definition language (VDL) are used to define internal and external schemas.• SDL is typically realized via DBMS commands provided to the DBA

and database designers

Page 6: Dbms chapter ii

Subject Name Code Credit HoursDatabase System COMP 219 3

Data Manipulation Language (DML)

• Language for accessing and manipulating the data organized by the appropriate data model– DML also known as query language

• Two classes of languages – Procedural – user specifies what data is required and

how to get those data – Declarative (nonprocedural) – user specifies what data is

required without specifying how to get those data• SQL is the most widely used query language

Page 7: Dbms chapter ii

Subject Name Code Credit HoursDatabase System COMP 219 3

Data Definition Language (DDL)• Specification notation for defining the database schema

Example: create table account ( account-number char(10), balance integer)

• DDL compiler generates a set of tables stored in a data dictionary• Data dictionary contains metadata (i.e., data about data)

– Database schema – Data storage and definition language

• Specifies the storage structure and access methods used– Integrity constraints

• Domain constraints• Referential integrity (references constraint in SQL)• Assertions

– Authorization

Page 8: Dbms chapter ii

Subject Name Code Credit HoursDatabase System COMP 219 3

DDL statements/commands in SQL• Create table table name(list of attribute & their

datatypes);• Create schema schema name authorization

author name;• Drop schema schema name cascade/restrict;• Drop table tablename cascade/restrict;• Alter table talename add/drop• Create view view name as (select …..)