Basheer Basheer
    • 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 New
    • 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 Note Insights Versions and GitHub Sync 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Relational vs Non Relational Databases ## :memo: Data structure ## Relational Databases relational database consists of two or more **tables** with **columns** and **rows**. Each row represents an entry, and each column sorts a very specific type of information, like a name, address, and phone number. The relationship between tables and field types is called a schema. In a relational database, the **schema** must be clearly defined before any information can be added. ### How SQL Databases Work For an SQL database, setting up a database for addresses begins with the **logical construction** of the **format** and the expectation that the records to be stored are going to remain **relatively unchanged**. After analyzing the expected query patterns, an SQL database might optimize storage in two tables, one for **basic information** and one pertaining to being a **customer**, with last name being the key to both tables. **Each row** in each table is a *single customer*, and **each column** has the following *fixed attributes*: **Basic information** Last name :: first name :: middle initial :: address fields :: email address :: phone number **Customer** Last name :: date of birth :: account number :: customer years :: communication preferences ![](https://i.imgur.com/SJF4T1A.jpg) ![](https://i.imgur.com/vLLxC81.jpg) ## Non-Relational Databases NoSQL aka "not only SQL" Non-relational databases come in a variety of **types** based on their data model. The main types are : 1. **Document** - store data in documents similar to JSON > Each document contains pairs of **fields** and **values**. The values can typically be a variety of types including things like strings, numbers, booleans, arrays, or objects 2. **Key-value databases**- keys and values > A value can typically only be retrieved by referencing its value 3. **Wide-column stores** - tables, rows, and dynamic columns. > flexibility over relational databases because each row is not required to have the same columns. > Many consider wide-column stores to be two-dimensional key-value databases. 4. **Graph databases** - store data in nodes and edges. > typically store information about **people**, **places**, and things while edges store information about the relationships between the nodes. ### How NoSQL Databases Work Four types previously described each has its own data model. Each type of NoSQL database would be designed with a **specific customer situation** in mind, and there would be **technical reasons** for how each kind of database would be organized. The simplest type to describe is the document database, in which it would be natural to combine both the *basic information* and the *customer information* in one JSON document. In this case, each of the SQL column attributes would be fields and the details of a customer’s record would be the data values associated with each field. **Basic information: customer information** For example: Last_name: "Jones", First_name: "Mary", Middle_initial: "S", etc ![](https://i.imgur.com/Zig8GIs.png) ### Which companies use relational databases? * Microsoft * NTT Data * Cognizant * Dell * Accenture * Stack Overflow ### Which companies use non relational databases? * Amazon * Adobe * Capgemini * SAP * Qualcomm * J.P. Morgan <hr> # 2. What are some advantages of relational data? Are there disadvantages? ##### :memo: Relational vs non-relational databases: advantages and disadvantages > Explaining a database and its types to a non-tech person may be hard. But Basheer and I accepted the challenge. In this Technical Spike, we compare relational vs. non-relational databases and help you make the right decision for your project![color=red] ![](https://clockwise.software/img/blog/relational-vs-non-relational-databases-advantages-and-disadvantages/header-background.jpg) :rocket: lets get started Does a web app need a database? Well, both yes and no. Everything depends on the type of the web app. Databases aren’t a crucial element. You can build a web app without it. However, this would make it a very basic static website with limited functionality, static content, and lack of customer interaction. If this doesn’t satisfy your requirements, then you need a web app with a database behind it USAGE OF DATABASES: - [ ] Static protoflio site - [x] Webapp with authentication - [x] Social media apps <hr> ### What is a database used for? ==A database is integral to any dynamic website.== When asking a user to register on your website or subscribe to your blog - their personal information lands in a database. For some website, lets say a portfolio, or a static webapp taht lacks user interatcions database are not so crucial! but for others, like a social media web app, a database is crucial, since this web app completely relies on user-generated content. >Thousands of images and millions of text messages are generated daily - guess where they all land? Of course, in a **database**, where they are safe and ready to be pulled up at any time.[color=blue] So, you now understand the true power of a database behind your web app. Now it’s time to review how it works! # Comparison of the two types of databases You can store your data in two ways: **Structured**( SQL ) - organizing data into rows and columns. As a result, you have a table (or multiple interconnected tables) where all your data is organized and stored clearly. :::info exampled of a well known SQL dbs: * PostgreSQL * One of the oldest relational databases, PostgreSQL is still on top. It’s reliable, robust and offers exceptional performance, which are the main reasons for its popularity. * MySQL * This popular relational database is used in various development stacks, MySQL is a universal solution and is compatible with major platforms (Linux, Windows, Mac, BSD, and Solaris). Many tech giants, including Facebook, Twitter, Yahoo!, and YouTube have websites based on MySQL. * MS SQL Server * An open-source Microsoft database is usually used as a part of the Windows environment. ::: **Document-like**( noneSQL ) - storing all data concerning a person/item in a single document(think like a JSON). This means you will have an array of documents, with all types of structured data. :::info exampled of a well known NoneSQL dbs: * MongoDB -- The true leader on the market is an open source database MongoDB. * Entries are stored as a BSON document, (a modification of JSON). MongoDB powers Craigslist, eBay, Foursquare, and The New York Times websites among others. * DynamoDB * This is a popular Amazon Web Services product used for storing and processing data. DynamoDB is appreciated for built-in security (encryption of documents) and in-memory caching for faster interactions. Samsung, Netflix, and Lyft are among the prominent users of DynamoDB. * Elasticsearch * Elasticsearch is a full-text search engine that is also often used as a non-relational database. The benefit of Elastic is the simplicity of its data architecture. Also, the response is much faster when compared to SQL databases. ::: Depending on how you prefer to store your data, you’ll have to make a choice between database type: relational vs. non-relational database. Basheer already explained how data is structured in a SQL db vs nonSQL db so ill jump into concluding the adv bs disAdv: **obviously**, A non-relational, or NoSQL database, works differently. It has to deal with semi-structured data. Each entry fits in a single JSON record. So, a NoSQL database looks like a folder with files rather than a table. ![](https://clockwise.software/img/blog/relational-vs-non-relational-databases-advantages-and-disadvantages/table-02.jpg) > **The obvious advantage of a non-relational database is the ability to store and process large amounts of unstructured data.** [color=purple] **As a result**, it can process ==**ANY**== type of data without needing to modify the **WHOLE** architecture. >So, creating and maintaining a NoSQL database is faster and cheaper.[color=green] However, there are disadvantages as well. >You’ll have to pay for this flexibility with extra processing efforts.[color=red] >Also, administration of a NoSQL database is more complicated.[color=red] >> Due to an imprecise data structure, transferring records to strongly typed programming languages becomes a challenge. When is non-relational database useful? >Social media, analytics software - the more various data types the application has to handle, the more obvious the usage of a NoSQL database becomes. [color=green] >> this however is also open for a debate, a very interesting example that contradicts this can be found in the **appropriately and conveniently** titled link below >> :::info >> :pushpin: [Why You Should Never Use MongoDB](http://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/) >> ::: # Conclusion The choice between a relational and non-relational database may seem difficult, but actually, all you have to do is define your needs and analyze the advantages and disadvantages of both types. If you work with well-structured, more or less constant data - an SQL database will be a better choice. It keeps your information organized and will save you storage space. However, if you have to handle various types of data, be ready for challenging database updates and maintenance. Otherwise, you can decide to use a NoSQL database, which stores all available data as files. Yes, it is less structured, but it takes much less time to create and maintain such a database.

    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