Outline
- Slidy
- Introduction to Databases
- An Example Database
Using Slidy
- The slides for this class are HTML files which both validate as HTML 5 and pass the WAVE Accessibility Checker.
- They are made to look like slides using a Javascript called Slidy.
- The following keystrokes do useful things in Slidy:
- h - help (see all the commands)
- f - fullscreen (gets rid of the links at the bottom of the window
- space - advance a slide
- left/right arrows - forward or back a slide
- up/down arrows - scroll within a slide
- a - show all slides at once for printing
- u - up to the list of lectures
Introduction
- Databases are now commonly used in banking, reservation systems, inventory management, universities, the web, etc.
- But what is a database?
- For us, a database is a collection of related data.
- Data for us is a collection of known facts with some explicit meaning.
- For example, you might have collections of facts about Employees, music files, etc.
Properties of Databases
- A database represents some aspect of the real world (a miniworld) which is called the universe of discourse. (Say bank account info) Changes in the information are reflected in the database.
- A database is a logically coherent collection of data --- A random assortment of data collected together is not a database.
- A database has an intended purpose, an intended group of users, and some preconceived uses. (For example, manage amounts of money in people's accounts in a bank.)
Database Management Systems
- Database Management Systems (DBMS's) are collections of programs that enable users to create, maintain, and access a database:
- To create a database involves tools for defining the data types, structures, constraints on the data and then populating it with
data.
- A DBMS provides tools for constructing the database by having programs to create the data structures for the storage of data in it using a Data Definition Language (DDL).
- It also provides tools/programs to populate these structure and to manipulate data that has been previously stored. These tools are usually used via a Data Manipulation Language (DML).
- To share and provide access to a database, a DBMS has provides facilities to allow multiple users to obtain and manipulate stored data while ensuring data integrity.
- A query language is implemented by the DBMS to allow users to ask questions about what data is stored in the database.
- The DBMS often also implements an access control system to control who has access to what data in the database.
- To maintain a database involves protecting the data for long periods of time. This involves protecting against software or hardware malfunctions as well as to protect the data from malicious or clumsy users.
An Example Database
- A database can often be represented as a sequence of named tables:
Student
Name | StudentID | Class | Major |
Brown | 8 | 2 | CS |
Smith | 17 | 1 | MATH |
Course
CourseName | CourseID | Credits | Dept |
Intro CS | 46 | 3 | CS |
Discrete Math | 42 | 3 | MATH |
Grade
StudentID | CourseID | Grade |
8 | 46 | A |
8 | 42 | A- |
17 | 42 | C |
- Columns in these tables are often called fields or attributes and often have names indicating what a value in this column represents. For example, StudentID in the Student table above.
- Notice that data in a given column has a fixed datatype. For example, StudentID above is an integer.
- Rows represent an entity with a given set of values for each of the columns. For example, a row in the Student tale represents the properties of a particular student such as that student's name, etc.