---
# System prepended metadata

title: Database

---

# Database
book: https://mucse44.net/wp-content/uploads/2019/09/Database-System-Concepts-7th-Edition.pdf
-----
### A database Needs to be 
- interrelated data
- centralised (even if it is over different systems physically) 
-  efficient programs to access data
-  takes care of integrety, concurrency, failure catering, 

DB is in the table form called a model (relational)
- atleast one column needs to be a primary key which will have unique values in every table
- one tables primary key can be another tables secondary referance and unique in this table and not the old one

physical  level -> logical level -> view level

physical data independance:  we dont need to woryy where the physical database is , on which system etc, we just need one interface to acess it or manipulate ut 
data definition language rceayes the basic data base, 
it gets compiled and a data dictionary can beis created which contains metadata like constraints
data manupulation languag: query language:
- relational algebra
- tuple relation calculuc
- domain relational calculuc


all get mapped to SQL
Procedural DML
Declarative DML
SQL:
- seelect
- from
- where
we write sql queries in python etc which fetch data from database
Data base cAccess from appliation program
Database design
logical design:
    - schema, relationals models etc
        - if one table: alot of empty info, make sure all values are updated, time complexity however one big table easy to make rows and u need a pproper fetching logic

physical design 

DataBase Engine

Storage file mechanism
- efficient, fast, robust, clean, physicle layer
- other than primary key therte can be indices in the logical layer

query processing
transaction management
- ensures the correctness of state

Data base Architecture:
- centralixed db
- client-server
- paralel database
- distributed db
two tier or three tier:
1. user interface , bussiness layer, 
2. physical database
