염딩코

What is Database? 본문

TIL

What is Database?

johnyeom 2023. 4. 13. 20:35

Database

  • Organized collection of inter-related data that models some aspect of the real-world.
  • Databases are the core component of most computer applications.

Flat File Strawman

(strawman은 잘 동작하지 않을 것을 의미함.)

  • Store our database as comma-separated value(CSV) files that we manage ourselves in our application code.
    • Use a separate file per entity.
    • The application must parse the files each time they want to read/update records.

Flat Files: Data Integrity

  • 각 앨범마다 정확한 아티스트가 기재되었는지 어떻게 보장?
  • 앨범의 연도를 잘못 기재했다면?
  • 아티스트가 여러 명이라면?
  • 아티스트가 삭제되었다면?

Flat Files: Implementation

  • 특정한 앨범을 어떻게 찾는가?
  • 동일한 데이터베이스를 사용하여 새로운 앱을 만들고 싶다면?
  • 두 스레드가 동일한 시간에 동일한 파일에 접근한다면?

Flat Files: Durability

  • 기계가 망가졌다면?
  • 데이터베이스를 동일한 기계에 복제하고 싶다면?

Database Management System

  • A database management system (DBMS) is software that allows applications to store and analyze information in a database. + (위의 문제들을 해결해줌.)
  • A general-purpose DBMS supports the definition, creation, querying, update, and administration of databases in accordance with some data model.

Data Models

  • A data model is a collection of concepts for describing the data in a database.
  • A schema is a description of a particular collection of data, using a given data model.

Relational Model

  • The relational model defines a database abstraction based on relations to avoid maintenance overhead. (그냥 표)
  • Key tenets:
    • Store database in simple data structures(relations).
    • Physical storage left up to the DBMS implementation.
    • Access data through high-level language, DBMS figures out best execution strategy.

  • Structure: The definition of the database’s relations and their contents.(타입도 정의해줘야 함.)
  • Integrity: Ensure the database’s contents satisfy constraints.(제약조건도 걸 수 있음.)
  • Manipulation: Programming interface for accessing and modifying a database’s contents.(데이터베이스를 고치거나 받아오는 인터페이스 제공)

  • Relation model은 unordered set(순서 상관x)
  • Tuple (순서쌍 → 순서 중요)

Relation Model: Primary Keys

  • Primary Keys(기본키): 튜플을 구분할 수 있는 키(like 학번)
  • _ 줄이 그어져 있음.
  • 기본키 두개 가능

Relation Model: Foreign Keys

  • Foreign Keys(외래키): 다른 테이블의 값을 참조하도록 되어 있다.

Databases are ubiquitous.

Relational algebra defines the primitives for processing queries on a relational database.

 

'TIL' 카테고리의 다른 글

[Algorithm] Backtracking이란?  (0) 2023.05.19
[Algorithm] 허프만 코드(Huffman code)  (0) 2023.05.18
[Algorithm] Merge sort & Quick sort  (0) 2023.03.30
동기 vs 비동기  (0) 2023.03.02
백트래킹(Backtracking)  (0) 2023.02.08