CPSC-608 Database Systems Fall 2018 Instructor: Jianer Chen Office: HRBB 315C Phone: 845-4259 Email: chen@cse.tamu.edu Notes 2
Undergraduate Database A Quick Review on Undergraduate Database
Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored? Operations are simpler & more specific: How do we take advantage of it? New programming languages for the above. (ACID) Reliability, security, consistency, currency π, σ, ρ, ∩, ⋃, \, ╳, ⋈, ⋈C SQL
Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored? Operations are simpler & more specific: How do we take advantage of it? New programming languages for the above. (ACID) Reliability, security, consistency, currency π, σ, ρ, ∩, ⋃, \, ╳, ⋈, ⋈C SQL
How Should Data be Stored? Large volume: cannot fit in memory, thus in general stored in disks;
How Should Data be Stored? Large volume: cannot fit in memory, thus in general stored in disks; Regular files are not organized enough;
How Should Data be Stored? Large volume: cannot fit in memory, thus in general stored in disks; Regular files are not organized enough; Hierarchical structure and network structure were considered, but became less popular;
How Should Data be Stored? Large volume: cannot fit in memory, thus in general stored in disks; Regular files are not organized enough; Hierarchical structure and network structure were considered, but became less popular; Table structures (2-dimensional arrays) are currently the most popular model (relational model);
How is Information Represented? How can everything be given by tables?
How is Information Represented? How can everything be given by tables? Well, information consists of objects/items and relationships among items;
How is Information Represented? How can everything be given by tables? Well, information consists of objects/items and relationships among items; An item has certain properties, which can be listed in a row. Thus, a collection of similar items can be given as a table, one row for an item;
How is Information Represented? How can everything be given by tables? Well, information consists of objects/items and relationships among items; An item has certain properties, which can be listed in a row. Thus, a collection of similar items can be given as a table, one row for an item; A relationship can be given by listing each item group that satisfies the relationship;
How is Information Represented? How can everything be given by tables? Well, information consists of objects/items and relationships among items; An item has certain properties, which can be listed in a row. Thus, a collection of similar items can be given as a table, one row for an item; A relationship can be given by listing each item group that satisfies the relationship; High-level representation of information (E-R Diagram: read Chapter 4)
Table structures (terminologies) Information is stored in tables (≡ relations); Each column of a table is an attribute, with an attribute name;
Table structures (terminologies) Information is stored in tables (≡ relations); Each column of a table is an attribute, with an attribute name; A database is a collection of relations;
Table structures (terminologies) Information is stored in tables (≡ relations); Each column of a table is an attribute, with an attribute name; A database is a collection of relations; An example table (Account): Account No. Balance Type 12345 20,520 checking 23456 1,000,000 CD 34567 26 savings 45678 7,023
Table structures (terminologies) A relation schema gives the name of the relation and its attributes;
Table structures (terminologies) A relation schema gives the name of the relation and its attributes; A database schema gives the schemas for all relations in the database;
Table structures (terminologies) A relation schema gives the name of the relation and its attributes; A database schema gives the schemas for all relations in the database; Schemas affects how the data is stored;
Table structures (terminologies) A relation schema gives the name of the relation and its attributes; A database schema gives the schemas for all relations in the database; Schemas affects how the data is stored; Database schemas are given and altered using data definition language (DDL);
Table structures (terminologies) A relation schema gives the name of the relation and its attributes; A database schema gives the schemas for all relations in the database; Schemas affects how the data is stored; Database schemas are given and altered using data definition language (DDL); Only database administrator can use DDL.
What is a good DB schema?
What is a good DB schema? What is a good table structure? Fat or thin?
What is a good DB schema? What is a good table structure? Fat or thin? More important: how can tables guarantee information consistency?
What is a good DB schema? What is a good table structure? Fat or thin? More important: how can tables guarantee information consistency? There is a beautiful theory (functional dependency) for constructing a good database schema;
What is a good DB schema? What is a good table structure? Fat or thin? More important: how can tables guarantee information consistency? There is a beautiful theory (functional dependency) for constructing a good database schema; Read Chapter 3.
Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored? Operations are simpler & more specific: How do we take advantage of it? New programming languages for the above. (ACID) Reliability, security, consistency, currency π, σ, ρ, ∩, ⋃, \, ╳, ⋈, ⋈C SQL