SQL & NoSQL Ahmad Awsaf-uz-zaman Apr 21, 2016 www.a2z-soft.com
What Is SQL?  SQL is used to communicate with a database  SQL is used to access and manipulate databases  SQL stands for Structured Query Language www.a2z-soft.com 2
What Can SQL do?  SQL can execute queries against a database  SQL can retrieve data from a database  SQL can insert records in a database  SQL can update records in a database  SQL can delete records from a database  SQL can create new databases  SQL can create new tables in a database  SQL can create stored procedures in a database  SQL can create views in a database  SQL can set permissions on tables, procedures, and views www.a2z-soft.com 3
SQL Used  An RDBMS database program (i.e. MS Access, SQL Server, MySQL)  To use a server-side scripting language, like PHP or ASP  To use SQL to get the data we want  To use HTML / CSS www.a2z-soft.com 4
RDBMS  RDBMS stands for Relational Database Management System.  RDBMS is the basis for SQL, and for all modern database systems such as MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.  The data in RDBMS is stored in database objects called tables.  A table is a collection of related data entries and it consists of columns and rows. www.a2z-soft.com 5
Why Is SQL Important?  It is mature and well understood  It can handle relational data models  It can handle hierarchical data models  It can handle unstructured data models  It can handle complex/nested transactions  It is an ISO / IEC standard  It can be used centralized applications (e.g. ERP) www.a2z-soft.com 6
SQL Database (Popular)  SQL Server  Oracle  MySQL  SQLite  PostgreSQL www.a2z-soft.com 7
What Is NoSQL?  Originally referring to "Non SQL" or "Not Only SQL" or "Non Relational"  NoSQL databases are sometimes referred to as cloud databases, non-relational databases, Big Data databases  A NoSQL database environment is, simply put, a non-relational and largely distributed database system that enables rapid, ad-hoc organization and analysis of extremely high-volume, disparate data types. www.a2z-soft.com 8
Types of NoSQL Databases  Graph database  Key-Value store  Column store  Document database www.a2z-soft.com 9
Why NoSQL?  The Growth of Big Data  Continuous Data Availability  Real Location Independence  Modern Transactional Capabilities  Flexible Data Models  Better Architecture  Analytics and Business Intelligence www.a2z-soft.com 10
Evaluating NoSQL databases Data model Performance Scalability Flexibility Complexity Functionality Key-value store High High High None Variable (None) Column Store High High Moderate Low Minimal Document Store High Variable (High) High Low Variable (Low) Graph Database Variable Variable High High Graph Theory www.a2z-soft.com 11
NoSQL Database (Popular)  MongoDB  Redis  Cassandra  CouchDB  HBase www.a2z-soft.com 12
Difference between SQL and NoSQL SQL NoSQL Store related data in tables Store related data in JSON-like, name-value documents Require a schema which defines tables prior to use Can store data without specifying a schema Encourage normalization to reduce data redundancy Must usually be denormalized so information about an item is contained in a single document Support table joins to retrieve related data from multiple tables in a single command Should not require joins (presuming denormalized documents are used) Implement data integrity rules Permit any data to be saved anywhere at any time without verification www.a2z-soft.com 13
Difference between SQL and NoSQL SQL NoSQL Provide transactions to guarantee two or more updates succeed or fail as an atomic unit Guarantee updates to a single document — but not multiple documents Can be scaled (with some effort) Provide excellent performance and scalability Use a powerful declarative language for querying Use JSON data objects for querying Offer plenty of support, expertise and tools. It is a newer, exciting technology. MySQL, Postgres, Microsoft SQL Server, Oracle Database MongoDB, Cassandra, HBase, Neo4j www.a2z-soft.com 14
Difference between SQL and NoSQL SQL NoSQL One type with minor variations Many different types including key-value stores, document databases, wide-column stores, and graph databases Mix of open-source (e.g., Postgres, MySQL) and closed source (e.g., Oracle Database) Open-source Specific language using Select, Insert, and Update statements, e.g. SELECT fields FROM table WHERE etc. Through object-oriented APIs Can be configured for strong consistency Depends on product. Some provide strong consistency (e.g., MongoDB, with tunable consistency for reads) whereas others offer eventual consistency (e.g., Cassandra). www.a2z-soft.com 15
Why Is NoSQL Important?  Large volumes of rapidly changing structured, semi-structured, and unstructured data  Agile sprints, quick schema iteration, and frequent code pushes  Object-oriented programming that is easy to use and flexible  Geographically distributed scale-out architecture instead of expensive, monolithic architecture www.a2z-soft.com 16
Conclusion All the choice provided by the rise of NoSQL databases does not mean the demise of RDBMS databases. We are entering an era of polyglot persistence, a technique that uses different data storage technologies to handle varying data storage needs. Polyglot persistence can apply across an enterprise or within a single application. www.a2z-soft.com 17

SQL & NoSQL

  • 1.
    SQL & NoSQL AhmadAwsaf-uz-zaman Apr 21, 2016 www.a2z-soft.com
  • 2.
    What Is SQL? SQL is used to communicate with a database  SQL is used to access and manipulate databases  SQL stands for Structured Query Language www.a2z-soft.com 2
  • 3.
    What Can SQLdo?  SQL can execute queries against a database  SQL can retrieve data from a database  SQL can insert records in a database  SQL can update records in a database  SQL can delete records from a database  SQL can create new databases  SQL can create new tables in a database  SQL can create stored procedures in a database  SQL can create views in a database  SQL can set permissions on tables, procedures, and views www.a2z-soft.com 3
  • 4.
    SQL Used  AnRDBMS database program (i.e. MS Access, SQL Server, MySQL)  To use a server-side scripting language, like PHP or ASP  To use SQL to get the data we want  To use HTML / CSS www.a2z-soft.com 4
  • 5.
    RDBMS  RDBMS standsfor Relational Database Management System.  RDBMS is the basis for SQL, and for all modern database systems such as MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.  The data in RDBMS is stored in database objects called tables.  A table is a collection of related data entries and it consists of columns and rows. www.a2z-soft.com 5
  • 6.
    Why Is SQLImportant?  It is mature and well understood  It can handle relational data models  It can handle hierarchical data models  It can handle unstructured data models  It can handle complex/nested transactions  It is an ISO / IEC standard  It can be used centralized applications (e.g. ERP) www.a2z-soft.com 6
  • 7.
    SQL Database (Popular) SQL Server  Oracle  MySQL  SQLite  PostgreSQL www.a2z-soft.com 7
  • 8.
    What Is NoSQL? Originally referring to "Non SQL" or "Not Only SQL" or "Non Relational"  NoSQL databases are sometimes referred to as cloud databases, non-relational databases, Big Data databases  A NoSQL database environment is, simply put, a non-relational and largely distributed database system that enables rapid, ad-hoc organization and analysis of extremely high-volume, disparate data types. www.a2z-soft.com 8
  • 9.
    Types of NoSQLDatabases  Graph database  Key-Value store  Column store  Document database www.a2z-soft.com 9
  • 10.
    Why NoSQL?  TheGrowth of Big Data  Continuous Data Availability  Real Location Independence  Modern Transactional Capabilities  Flexible Data Models  Better Architecture  Analytics and Business Intelligence www.a2z-soft.com 10
  • 11.
    Evaluating NoSQL databases Datamodel Performance Scalability Flexibility Complexity Functionality Key-value store High High High None Variable (None) Column Store High High Moderate Low Minimal Document Store High Variable (High) High Low Variable (Low) Graph Database Variable Variable High High Graph Theory www.a2z-soft.com 11
  • 12.
    NoSQL Database (Popular) MongoDB  Redis  Cassandra  CouchDB  HBase www.a2z-soft.com 12
  • 13.
    Difference between SQLand NoSQL SQL NoSQL Store related data in tables Store related data in JSON-like, name-value documents Require a schema which defines tables prior to use Can store data without specifying a schema Encourage normalization to reduce data redundancy Must usually be denormalized so information about an item is contained in a single document Support table joins to retrieve related data from multiple tables in a single command Should not require joins (presuming denormalized documents are used) Implement data integrity rules Permit any data to be saved anywhere at any time without verification www.a2z-soft.com 13
  • 14.
    Difference between SQLand NoSQL SQL NoSQL Provide transactions to guarantee two or more updates succeed or fail as an atomic unit Guarantee updates to a single document — but not multiple documents Can be scaled (with some effort) Provide excellent performance and scalability Use a powerful declarative language for querying Use JSON data objects for querying Offer plenty of support, expertise and tools. It is a newer, exciting technology. MySQL, Postgres, Microsoft SQL Server, Oracle Database MongoDB, Cassandra, HBase, Neo4j www.a2z-soft.com 14
  • 15.
    Difference between SQLand NoSQL SQL NoSQL One type with minor variations Many different types including key-value stores, document databases, wide-column stores, and graph databases Mix of open-source (e.g., Postgres, MySQL) and closed source (e.g., Oracle Database) Open-source Specific language using Select, Insert, and Update statements, e.g. SELECT fields FROM table WHERE etc. Through object-oriented APIs Can be configured for strong consistency Depends on product. Some provide strong consistency (e.g., MongoDB, with tunable consistency for reads) whereas others offer eventual consistency (e.g., Cassandra). www.a2z-soft.com 15
  • 16.
    Why Is NoSQLImportant?  Large volumes of rapidly changing structured, semi-structured, and unstructured data  Agile sprints, quick schema iteration, and frequent code pushes  Object-oriented programming that is easy to use and flexible  Geographically distributed scale-out architecture instead of expensive, monolithic architecture www.a2z-soft.com 16
  • 17.
    Conclusion All the choiceprovided by the rise of NoSQL databases does not mean the demise of RDBMS databases. We are entering an era of polyglot persistence, a technique that uses different data storage technologies to handle varying data storage needs. Polyglot persistence can apply across an enterprise or within a single application. www.a2z-soft.com 17