Chapter 9 Databases
Objectives Understand a DBMS and define its components. Understand the architecture of a DBMS and its levels. Distinguish between different database models. Understand the concept of relational database operations on a relation. Use Structured Query Language (SQL) to define simple relations.
Databases and DBMS A database is a collection of data that is logically, but not necessarily physically, coherent. A database management system defines, creates, and maintains a database. It also allows users controlled access to data in the database.
DBMS components
Database architecture
DB models - hierarchical
DB models – network
DB model - relational
Relation A relation, in appearance, is a two- dementional table.
SQL The structured query language is the standardized language we use to operate on relational databases. It is a declarative (not procedural) language, which means that the users declare what they want without having to write a step-by- step procedure.
Operations on relations - insert insert into COURSES values (“CIS52”, “TCP/IP Protocols”, 6)
Operations on relations - delete delete from COURSES where No=“CIS19”
Operations on relations - update update COURSES set Unit = 6 where No = “CIS51”
Operations on relations - select select * from COURSES where Unit = 5
Operations on relations - project select No, Unit from COURSES
Operations on relations - join select No, Course-Name, Unit, Professor from COURSES, TAUGHT-BY where COURSES.No = TAUGHT-BY.No
Operations on relations - union select * from CIS15-Roster union select * from CIS52-Roster
Operations on relations - intersection select * from CIS15-Roster intersection select * from CIS52-Roster
Operations on relations - difference select * from CIS15-Roster minus select * from CIS52-Roster
Objectives Understand a DBMS and define its components. Understand the architecture of a DBMS and its levels. Distinguish between different database models. Understand the concept of relational database operations on a relation. Use Structured Query Language (SQL) to define simple relations.