acytoo

Database Relational Model

Example of a Relation

Attribute Types

  • The set of allowed values for each attribute is called the domain of the attribute
  • Attribute values are (normally) required to be atomic; that is, indivisible
  • The special value null is a member of every attribute
  • The null value causes complication in the definition of many operations

Relation Schema and Instance

  • A1,A2,โ‹ฏโ€‰,AnA_1, A_2, \cdots, A_n are attributes
  • R=(A1,A2,โ‹ฏโ€‰,An)R = (A_1, A_2, \cdots, A_n) is a relation schema Example: instructor = (ID, name, dept_name, salary)
  • Formally, given sets D1,D2,โ‹ฏโ€‰,DnD_1 ,D_2, \cdots, D_n a relation r is a subset of D1ร—D2ร—โ‹ฏร—DnD_1 \times D_2 \times \cdots \times D_n Thus, a relation is a set of n-tuples(a1,a2,โ‹ฏโ€‰,ana_1, a_2, \cdots, a_n) where each aiโˆˆDia_i \in D_i
  • The current values(relation instance) of a relation are specified bu a table
  • An element t of r is a tuple, represented by a row in a table

Relations are Unordered

  • Order of tuples is irrelevant (tuples may be stored in an arbitrary order)
  • This is on the logical design level - ordering can be defined on physical level
  • A database consists of multiple relations
  • Information about an enterprise is broken up into parts instructor, student, advisor
  • Bad design: univ (instructor_id, name, dept_name, salary, student_id, ...) results in
    • repetition of information (e.g., two student have the same instructor)
    • the need for full values (e.g., represent a student with no advisor)
  • Normalization theory deals with how to design "good" relational schemas(What is good)

Keys

superkey: K is a superkey of R if values for K are sufficient to identify a unique tuple of any possible relation r(R)

Database Introduction

Drawbacks of using file systems to store data:

  • Data redundancy and inconsistency
    • Multiple file formats, duplication of information in different files
  • Difficulty in accessing data
    • Need to write a new program to carry out each new task
  • Data isolation
    • multiple files and formats
  • Integrity problems
    • Integrity constraints become "burned" in program code rather than being stated explicitly.
    • Hard to add new constraints or change existing ones
  • Atomicity of updates
    • Failures may leave database in an inconsistent state with partial updates carried out
    • Example: Transfer of funds from one account to another should either complete or not happen at all
  • Concurrent access by multiple users
    • Concurrent accessed needed for performance and usability
    • Uncontrolled concurrent access can lead to inconsistencies
      • Example: Two people reading a balance and updating it at the same time
  • Security problems
    • Hard to provide user/apps access to some, but not all, data

Modern database systems offer solutions to all the above problems

Normal Distribution

Normal distribution, also known as Gaussian, Gauss, or Laplace-Gauss distribution, is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is

f(x)=1 f(x) = \frac{1}{}

โˆ‚ฯโˆ‚t+โˆ‡โ‹…jโƒ—=0 \frac{\partial \rho}{\partial t} + \nabla \cdot \vec{j} = 0

The graph depiction of normal distribution is called bell curve, because it looks like a bell.

Add systemd servic, and set start on boot

The most commonly used locations for loading systemd files are

  • units installed by softwares /usr/lib/systemd/system/ or /lib/systemd/system/

  • units installed by users /etc/systemd/system/

We can use man systemd.unit, man systemd.service commands to get some basic understanding about systemd.

A systemd unit could be one of the following type: .service, .socket, .device, .mount, .automount, .swap, .target, .path, .timer, .slice, .scope