the database

11
The database An introduction to the catalogs

Upload: brittnee-noble

Post on 30-Dec-2015

15 views

Category:

Documents


0 download

DESCRIPTION

The database. An introduction to the catalogs. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: The database

The database

An introduction to the catalogs

Page 2: The database

One of the neat things about a relational database system is that the internal schema information that describes what relations exist in the database, the format of their attributes, and what attributes have indices on them, is also stored in relationsThis schema is called the catalogs.

Page 3: The database

There are two main catalogs: – relCat– attrCat

The relCat relation is used to keep track of all of the relations in the database. It contains one tuple for each relation. The attrCat relation is used to maintain information about the attributes of each relation. It contains one tuple for each attribute of each relation

Page 4: The database

Relation Catalog

Relation Description Component– Relation name– Relation Length– Attribute count– Record count– Sort Field– Format

Page 5: The database

Attribute Information Component– Attribute number– Attribute Offset– Attribute length– Attribute Type– Attribute Name– Relation Name

Page 6: The database

Attribute Catalog

Attribute Description Component– Relation Name– Attribute Name– Attribute Offset– Attribute Type– Attribute Length– Indexed

Page 7: The database

Attribute Catalog Class Methods

Status getInfo( char* relation, char* attrName, attrDesc& record); Status addInfo(AttrDesc record); Status removeInfo(char* relation, char* attrName); Status getRelInfo(char* relation, int& attrCnt, AttrDesc*& attrs); Status dropRelation(char* relation); Status addIndex(char* relation, char* attrname); Status dropIndex(char* relation, char* attrname);

Page 8: The database

Relation Catalog Class Methods

Status createRel (char* relation, int attrCnt, attrInfo attrList[ ]); Status destroyRel (char* relation); Status addIndex (char* relation, char* attrname); Status dropIndex (char* relation, char* attrname); Status addInfo (RelDesc record); Status getInfo (char* relation, RelDesc& record); Status help (char* relation );

Page 9: The database

Relation Catalog 

Relation Name

Record Length

Attribute Count

Record Count Sort field Format

           

           

           

           

           

           

 

Page 10: The database

Attribute Catalog 

Attribute Number

Attribute Offset

Attribute Length

Attribute Type

Attribute Name

Relation Name

           

           

           

           

           

           

           

Page 11: The database

Lets look at the Assignment And the hand out