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
    --- disqus: hackmd --- Databases and SQL for Data Science with Python <br> WEEK_1 - Getting Started with SQL ==== ###### tags: `IBM Data Engineering Professional Certificate`,`Reading Note`,`Coursera`,`Databases and SQL for Data Science with Python` ### Overview >* 講解 Database, Relational Database, DBMS, RDBMS 和 SQL 的功能及之間的差異。 >* 運用 SQL 的 SELECT, WHERE, COUNT, DISTINCT, LIMIT, INSERT, UPDATE, DELETE 指令操作 database 裡的資料。 <br> ## Basic SQL ### 1. Welcome to SQL for Data Science * 在Data的領域中,都會需要使用SQL來訪問資料庫裡的資料。 <br> ### 2. Introduction to Databases * SQL (Structured Query Language) * 查詢關聯資料庫中的語言 * Data * Facts(words, numbers) * 在商業裡其中一個有價值的資產 * 需要安全的環境 * Database * 資料倉庫 * 提供新增,更新,查詢資料的功能 * 目前有多種資料庫提供儲存各種的資料 * Relational Database * 提供儲存表格資料-行列格式 * 每列會有一個屬性 * Table包含物件 * Relational是Table之間的關係 * DBMS * 資料庫=資料倉庫 * DBMS(Database Management System) * 資料管理的軟體 * Database = Database Server = Database System = Data Server = Database Management Systems * RDBMS * RDBMS(Relational Database Management System) * 包含各種操作資料的軟體 * access * organization * storage * 目前的產品有: * MySQL * Oracle Database * IBM Db2 * Basic SQL Command * 在Table操作資料的基本指令 * Create a table * Insert * Select * Update * Delete <br> ### 3. SELECT Statement * Retrieving rows from a table * SELECT statement * SELECT 是個 DML(Data Manipulation Language)語言,是用作讀取及更新資料 * Using the SELECT statement * 使用 * 號提取所有在table裡的所有資料 ```SQL= SELECT * FROM <tablename> ``` * Retrieving a subset of the columns * 提取想要的column裡的資料 ```SQL= SELECT <column 1>, <column 2> FROM <tablename> ``` * Restricting the result set : WHERE clause * 使用關鍵字搜尋資料庫裡的資料 ```SQL= SELECT * FROM <tablename> WHERE <column> = 'keyword' ``` * WHERE clause comparision operators * SQL的比較運算符 <br>![](https://i.imgur.com/fRteRlN.png =300x) <br> ### 4. COUNT, DISTINCT, LIMIT * COUNT * 計算rows在table裡的數量 ```SQL= SELECT COUNT(*) FROM <tablename> ``` * 與WHERE一併使用 ```SQL= SELECT COUNT(*) FROM <tablename> WHERE <column> = 'keyword' ``` * DISTINCT * 與COUNT的差別在於,DISTINCT只會回傳唯一的資料 ```SQL= SELECT DISTINCT <column> FROM <tablename> ``` * LIMIT * Rows會被顯示的數量 ```SQL= SELECT * FROM <tablename> LIMIT 10 ``` * 與WHERE一併使用 ```SQL= SELECT * FROM <tablename> WHERE <column> = 'keyword' LIMIT 10 ``` <br> ### 5. INSERT Statement * Adding rows to a table * INSERT statement * SELECT 是個 DML(Data Manipulation Language)語言,是用作讀取及更新資料 * Using the INSERT statement * 把資料存入到table ```SQL= INSERT INTO <tablename> (column 1, column 2, column 3) VaLUES ('value 1', 'value 2', 'value 3') ``` * Inserting multiple rows * 存入一筆以上的資料 ```SQL= INSERT INTO <tablename> (column 1, column 2, column 3) VaLUES ('value 1', 'value 2', 'value 3') ('value a', 'value b', 'value c') ``` ### 6. UPDATE and DELETE Statements * Altering rows of a table - UPDATE statement * UPDATE statement * UPDATE 是個 DML(Data Manipulation Language)語言,是用作讀取及更新資料 * Using the UPDATE statement * 修改table裡的資料 ```SQL= UPDATE <tablename> SET <column 1> = 'new information 1', <column 2> = 'new information 2' WHERE <column> = 'specific information' ``` * Deleting rows from a table * DELETE statement * DELETE 是個 DML(Data Manipulation Language)語言,是用作讀取及更新資料 * Using the DELETE statement * 刪除table裡的row ```SQL= DELETE FROM <tablename> WHERE column IN ('specific information 1', 'specific information 2') ``` ## Summary & Highlights * 課程完整整理的內容,所以把它記錄下來 * You can use Data Manipulation Language (DML) statements to read and modify data. * The search condition of the WHERE clause uses a predicate to refine the search. * COUNT, DISTINCT, and LIMIT are expressions that are used with SELECT statements. * INSERT, UPDATE, and DELETE are DML statements for populating and changing tables. <br>

    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