Introduction

What is a database?

definition: A database is a collection of information that exists over a long period of time.

A Database Management System (DBMS) a complex system for managing database interactions.

  1. Allows users to easily create new databases and specify schema.
  2. Enables users for search and modify data.
  3. Stores data intelligently,
    • Protects from accidental use
    • Allows efficient access, e.g., indexing
  4. Manages cuncurrent data accesses and modifications.
  5. Recovers from failures and crashes.

Relational Databases

A database system should present the user with a view of the data organized as tables (or relations).

So Relations are represented as Tables, column headers are attribute names. Each row is a tuple.

Access with Structured Query Language (SQL).

e.g.

Given the database

accountNo balance type
12345 1000.00 savings
67890 2846.92 checking
  1. What’s the balance of account “67890”?
SELECT balance
FROM Accounts
WHERE accountNo = 67890;
  1. Which are the savings accounts with negative balances?
SELECT accountNo
FROM Accounts
WHERE type = savings AND balance < 0;