Jiayong
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    W1 ==== ### Overview >database里的data type,数据关系图,还有各种database的架构优势。 > ## Fundamental Relational Database Concepts ### 1. Review of Data Fundamentals * 对data的部分做Review: * Data type: * Structured * Semi-structured * Unstructed * Data source * File format * Data repositories * OLTP * OLAP ### 2. Information and Data Models * Information Model * Concept/Abstract Model For Designers And Operators. * hierarchical model organizes(tree structure) * Data Model * Concrete Detailed Model For Implementers * 多在使用 Relational Model * Relational Model * 数据獨立 * 数据存入Tables * 提供一些特性: * Logical data independence * Physical data independence * Physical storage independence * Entity-Relationship Model * Relational databases 的设计工具 * Building block: * Entities * Attributes<br><br> ![](https://i.imgur.com/ZmoKAfK.png)<br><br> * 以上图片:ER Diagram * Book是Entities,Title,Edition及其他的是Book的Attributes。 * Example of ER Diagram ![](https://i.imgur.com/JUlGdA9.png) ### 3. ERDs & Types of Relationship * One-to-one Relationshaip * A book written by many authors ![](https://i.imgur.com/J3Bb34L.png) * One-to-Many Relationship * A book written ny many authors ![](https://i.imgur.com/eXtoNYt.jpg) * Many-to-Many Relationship * Many books written by many authors * Many authors writing many books * Crows foot notation uses greater-than and less-than symbols ![](https://i.imgur.com/4Zmm8An.png) ### 4. Mapping Entities to Tables * Mapping an ERD to a table * 把ER上定义Entity和Attribute物件,对应到table的columns上 ![](https://i.imgur.com/6JEE3KG.png) * 结果如下表: ![](https://i.imgur.com/tHRvan1.png) ### 5. Data Types * Character string * Fixed length * Example: * CHAR(10) * Variable length * Example: * VARCHAR(20) * LONGCHAR * Numeric * Integer * Example: * INT * SMALLINT * BIGINT * * Decimal * Example: * DECIMAL * NUMERIC * FLOAT * SINGLE * DOUBLE * Date/time * Date * Example: * 2021-12-32 * Time * Example: * 02.11.35 * Timestamp * Example: * 2021-12-31-02.11.35.00 * Other data types * Boolean * Binary string * Large object * XML * User defined types * Advantages of using data types * Data integrity * Data sorting * Range selection * Data calculations * Use of standard function ### 5. Relational Model Concepts * Building blocks * Relation * Mathematical term for table * Relation Schema * Specifies relation name and attributes * Relation Instance * A table made up of rows and columns * Column * Attributes * Field * Row * Tuple * Degree * The number of attributes in a relation * Cardinality * The number of tuples * Specifies * Name of a ralation, name and type of each column * Relation Schema 和 Relation Instance 的图說: ![](https://i.imgur.com/VZUV3rx.png) * Sets * Unordered collection of distinct element * Items of same type * No order and no duplicates ## Introducing Relational Database Products ### 1. Database Architecture * Deployment Topologies * Local * Resides on the user's system * Single user environment * Single-tier architecture * 使用场景: * Development / test * Database embedded in a local application * Client/Server * Databases resides on a database server * Users acsess database from client systems * Sometime there is a middle-tier(Application Server layer) ![](https://i.imgur.com/3idaA35.png) * Cloud * Databases resides in a cloud environment * No need to download or install software * Can access easily * Access the database through an application server layer or interface in the cloud ![](https://i.imgur.com/Lx1WTIi.png) * 2-Tier Database Architecture ![](https://i.imgur.com/kqG62AC.png) * 3-Tier Database Architecture ![](https://i.imgur.com/8fWdmRn.png) ### 2. Distributed Architecture and Clustered Databases * Database Architecture * 使用场景: * Mission Critical * Large scale workloads * 特性: * High Availability * High Scalability requirements * 实践方法: * Databases distributed on a cluster of servers * Shared disk architecture * Share common storage * 把数据分散到数个Database Server,当某个Database Server出问题还有其他的Database Server作为后备支援。 * 正常运作 ![](https://i.imgur.com/kQKFgCm.png) * Database Server故障 ![](https://i.imgur.com/14EKcet.png) * Shared nothing architecture * Replication(复制) * 使用场景: * 主要Database Server故障,所以会把访问转移到备份Database Server ![](https://i.imgur.com/A5eeWtF.png) * 转移至正常运作Database Server的地方 ![](https://i.imgur.com/7WswxoG.png) * Partitioning * 把不同属性的数据存在不同的Database Server上,分担访问负载 ![](https://i.imgur.com/pud1pWq.png) * 当访问过载的时候,可以增设Database Server分担访问负载 ![](https://i.imgur.com/XDrCVCU.png) ### 3. Database Usage Patterns * The main classes of users are: * Data engineer * Data Scientists and Business Analysts * Application Developers * Databases can be accesses through: * Graphical and wrb interfaces * Command line tools and scripts * APIs and ORMs * Major categories of databese applications include: * Database Management tools * Data Science and BI tools * Business and Industry Applications ### 4. Introduction to Relational Database Offerings * 本章主要讲解Relational Database的发展,以及介绍现有Database。 * Comercial license 与 opensource 的发展趋势。 ### 5. Db2 * Features: * AI- powered functionality: * Machine Learning algorithms * Column store * Data skipping * Common SQL Engine * Support for all data types * High availability and disaster recovery * Scalability * Table partitioning * DB2分支: * Db2 database * Db2 warehouse * Db2 on Cloud * Db2 Big SQL ### 5. MySQL * Object-relational database * Low maintenance database * Clusterd database * Supports many operating systems * Unix * Linux * Windows * Supports a range og languages for client application development * Python * Java * JavaScript * C++ * c * SQL * Support relational and JSON data * Provides mutiple storage engines for differing workloads * InnoDB * Transactions * Row-level locking * Clustered indexes * Foraign keys * MyISAM * For data warehouse and web applications * Table-level locking * NDB * Cluster * High availability * High redundancy * Provides high availability and scalability options ### 6. PostgreSQL * Open source * Object-relational databases * Simplify design * Reuse objects * Supports many operating systems * Unix * Linux * Windows * Support a range of languages for client application development * Python * Java * JavaScript * C++ * C * SQL * Supports relational,structured, and non-structured data * Support replication and partitioning for high availability and scalability * Multi-node asynchronous replication * Milti-master read/write replication

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully