Source: https://www.mongodb.com/nosql-explained
What
is NoSQL?
NoSQL
encompasses a wide variety of different database technologies that were
developed in response to the demands presented in building modern applications:
·
Developers are working with applications
that create massive volumes of new, rapidly changing data types — structured,
semi-structured, unstructured and polymorphic data.
·
Long gone is the twelve-to-eighteen
month waterfall development cycle. Now small teams work in agile sprints,
iterating quickly and pushing code every week or two, some even multiple times
every day.
·
Applications that once served a finite
audience are now delivered as services that must be always-on, accessible from
many different devices and scaled globally to millions of users.
·
Organizations are now turning to
scale-out architectures using open source software, commodity servers and cloud
computing instead of large monolithic servers and storage infrastructure.
Relational
databases were not designed to cope with the scale and agility challenges that
face modern applications, nor were they built to take advantage of the
commodity storage and processing power available today.
Spin up a NoSQL cluster in minutes with the MongoDB Atlas: Hosted
Database as a Service
Try
out the easiest way to start learning and prototyping applications on MongoDB,
the leading non-relational database.
Launching
an application on any database typically requires careful planning to ensure
performance, high availability, security, and disaster recovery – and these
obligations continue as long as you run the application. With MongoDB Atlas,
you receive all of the features of MongoDB without any of the operational heavy
lifting, allowing you to focus instead on learning and building your apps.
Features include:
·
On-demand, pay as you go model
·
Seamless upgrades and auto-healing
·
Fully elastic. Scale up and down with
ease
·
Deep monitoring & customizable
alerts
·
Highly secure by default
·
Continuous backups with point-in-time
recovery
NoSQL
Database Types
·
Document databases pair
each key with a complex data structure known as a document. Documents can
contain many different key-value pairs, or key-array pairs, or even nested
documents.
·
Graph stores are
used to store information about networks of data, such as social connections.
Graph stores include Neo4J and Giraph.
·
Key-value stores are
the simplest NoSQL databases. Every single item in the database is stored as an
attribute name (or 'key'), together with its value. Examples of key-value
stores are Riak and Berkeley DB. Some key-value stores, such as Redis, allow
each value to have a type, such as 'integer', which adds functionality.
·
Wide-column stores such
as Cassandra and HBase are optimized for queries over large datasets, and store
columns of data together, instead of rows.
The Benefits
of NoSQL
When compared to
relational databases, NoSQL databases are more scalable and provide
superior performance, and their data model addresses several
issues that the relational model is not designed to address:
·
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
Read our free white paper: Top 5 Considerations When Evaluating NoSQL
Databases and learn about:
·
Selecting the appropriate data model:
document, key-value & wide column, or graph model
·
The pros and cons of consistent and
eventually consistent systems
·
Why idiomatic drivers minimize
onboarding time for new developers and simplify application development
Dynamic
Schemas
Relational
databases require that schemas be defined before you can add data. For example,
you might want to store data about your customers such as phone numbers, first
and last name, address, city and state – a SQL database needs to know what you
are storing in advance.
This fits poorly with agile development approaches, because each time
you complete new features, the schema of your database often needs to change.
So if you decide, a few iterations into development, that you'd like to store
customers' favorite items in addition to their addresses and phone numbers,
you'll need to add that column to the database, and then migrate the entire
database to the new schema.
If
the database is large, this is a very slow process that involves significant
downtime. If you are frequently changing the data your application stores –
because you are iterating rapidly – this downtime may also be frequent. There's
also no way, using a relational database, to effectively address data that's
completely unstructured or unknown in advance.
NoSQL
databases are built to allow the insertion of data without a predefined schema.
That makes it easy to make significant application changes in real-time,
without worrying about service interruptions – which means development is
faster, code integration is more reliable, and less database administrator time
is needed. Developers have typically had to add application-side code to
enforce data quality controls, such as mandating the presence of specific
fields, data types or permissible values. More sophisticated NoSQL databases
allow validation rules to be applied within the database, allowing users to
enforce governance across data, while maintaining the agility benefits of a
dynamic schema.
Auto-sharding
Because
of the way they are structured, relational databases usually scale vertically –
a single server has to host the entire database to ensure acceptable
performance for cross- table joins and transactions. This gets expensive
quickly, places limits on scale, and creates a relatively small number of
failure points for database infrastructure. The solution to support rapidly
growing applications is to scale horizontally, by adding servers instead of
concentrating more capacity in a single server.
'Sharding'
a database across many server instances can be achieved with SQL databases, but
usually is accomplished through SANs and other complex arrangements for making
hardware act as a single server. Because the database does not provide this
ability natively, development teams take on the work of deploying multiple
relational databases across a number of machines. Data is stored in each
database instance autonomously. Application code is developed to distribute the
data, distribute queries, and aggregate the results of data across all of the
database instances. Additional code must be developed to handle resource
failures, to perform joins across the different databases, for data
rebalancing, replication, and other requirements. Furthermore, many benefits of
the relational database, such as transactional integrity, are compromised or
eliminated when employing manual sharding.
NoSQL
databases, on the other hand, usually support auto-sharding, meaning that they
natively and automatically spread data across an arbitrary number of servers,
without requiring the application to even be aware of the composition of the
server pool. Data and query load are automatically balanced across servers, and
when a server goes down, it can be quickly and transparently replaced with no
application disruption.
Cloud computing makes this significantly easier,
with providers such as Amazon Web Services providing virtually unlimited
capacity on demand, and taking care of all the necessary infrastructure
administration tasks. Developers no longer need to construct complex, expensive
platforms to support their applications, and can concentrate on writing
application code. Commodity servers can provide the same processing and storage
capabilities as a single high-end server for a fraction of the price.
Replication
Most
NoSQL databases also support automatic database replication to maintain
availability in the event of outages or planned maintenance events. More
sophisticated NoSQL databases are fully self-healing, offering automated
failover and recovery, as well as the ability to distribute the database across
multiple geographic regions to withstand regional failures and enable data
localization. Unlike relational databases, NoSQL databases generally have no
requirement for separate applications or expensive add-ons to implement
replication.
Integrated
Caching
A
number of products provide a caching tier for SQL database systems. These
systems can improve read performance substantially, but they do not improve
write performance, and they add operational complexity to system deployments.
If your application is dominated by reads then a distributed cache could be
considered, but if your application has just a modest write volume, then a
distributed cache may not improve the overall experience of your end users, and
will add complexity in managing cache invalidation.
Many
NoSQL database technologies have excellent integrated caching capabilities,
keeping frequently-used data in system memory as much as possible and removing
the need for a separate caching layer. Some NoSQL databases also offer fully
managed, integrated in-memory database management layer for workloads demanding
the highest throughput and lowest latency.
NoSQL vs.
SQL Summary
SQL
Databases
|
NOSQL
Databases
|
|
Types
|
One
type (SQL database) with minor variations
|
Many
different types including key-value stores, document databases, wide-column stores, and graph
databases
|
Development History
|
Developed
in 1970s to deal with first wave of data storage applications
|
Developed
in late 2000s to deal with limitations of SQL databases, especially
scalability, multi-structured data, geo-distribution and agile development
sprints
|
Examples
|
MySQL,
Postgres, Microsoft SQL Server, Oracle Database
|
MongoDB,
Cassandra, HBase, Neo4j
|
Data Storage Model
|
Individual
records (e.g., 'employees') are stored as rows in tables, with each column
storing a specific piece of data about that record (e.g., 'manager,' 'date
hired,' etc.), much like a spreadsheet. Related data is stored in separate
tables, and then joined together when more complex queries are executed. For
example, 'offices' might be stored in one table, and 'employees' in another.
When a user wants to find the work address of an employee, the database
engine joins the 'employee' and 'office' tables together to get all the
information necessary.
|
Varies
based on database type. For example, key-value stores function similarly to
SQL databases, but have only two columns ('key' and 'value'), with more
complex information sometimes stored as BLOBs within the 'value' columns.
Document databases do away with the table-and-row model altogether, storing
all relevant data together in single 'document' in JSON, XML, or another
format, which can nest values hierarchically.
|
Schemas
|
Structure
and data types are fixed in advance. To store information about a new data
item, the entire database must be altered, during which time the database
must be taken offline.
|
Typically
dynamic, with some enforcing data validation rules. Applications can add new
fields on the fly, and unlike SQL table rows, dissimilar data can be stored
together as necessary. For some databases (e.g., wide-column stores), it is
somewhat more challenging to add new fields dynamically.
|
Scaling
|
Vertically,
meaning a single server must be made increasingly powerful in order to deal
with increased demand. It is possible to spread SQL databases over many
servers, but significant additional engineering is generally required, and
core relational features such as JOINs, referential integrity and
transactions are typically lost.
|
Horizontally,
meaning that to add capacity, a database administrator can simply add more
commodity servers or cloud instances. The database automatically spreads data
across servers as necessary.
|
Development Model
|
Mix
of open-source (e.g., Postgres, MySQL) and closed source (e.g., Oracle
Database)
|
Open-source
|
Supports Transactions
|
Yes,
updates can be configured to complete entirely or not at all
|
In
certain circumstances and at certain levels (e.g., document level vs.
database level)
|
Data Manipulation
|
Specific
language using Select, Insert, and Update statements, e.g. SELECT fields FROM
table WHERE…
|
Through
object-oriented APIs
|
Consistency
|
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).
|
Implementing a NoSQL Database
Often,
organizations will begin with a small-scale trial of a NoSQL database in their
organization, which makes it possible to develop an understanding of the
technology in a low-stakes way. Most NoSQL databases are also open-source,
meaning that they can be downloaded, implemented and scaled at little cost.
Because development cycles are faster, organizations can also innovate more
quickly and deliver superior customer experience at a lower cost.
As
you consider alternatives to legacy infrastructures, you may have several
motivations: to scale or perform beyond the capabilities of your existing
system, identify viable alternatives to expensive proprietary software, or
increase the speed and agility of development. When selecting the right
database for your business and application, there are five important dimensions
to consider.
Free White
Paper
Read our free white paper:Top 5 Considerations When Evaluating NoSQL
Databasesand learn about:
·
Selecting the appropriate data model:
document, key-value & wide column, or graph model
·
The pros and cons of consistent and
eventually consistent systems
·
Why idiomatic drivers minimize
onboarding time for new developers and simplify application development
Learn More
MongoDB University
Source: https://www.thesitewizard.com/faqs/what-is-mysql-database.shtml
What is MySQL? What is a Database? What is SQL?
Definitions of MySQL, SQL and Database for New Webmaster
What is MySQL? What is a Database? What is SQL?
by Christopher Heng, thesitewizard.comAmong the things I'm sometimes asked by new webmasters are "What is MySQL?", "What is SQL" and "What is a database?". These questions arise because such terms tend to surface all over the place in connection with the creation of a website. This article explains them in (hopefully) plain English.
Who is This Article For?
This article is written from the point of view of a webmaster and is directed at potential webmasters (or existing webmasters) who are suddenly confronted by cryptic terms like "MySQL database" or "PostgreSQL database" and the like.
It is not meant to be a rigorous academic definition for programming students. If you are one, you should consult a programming book for the proper definition. The explanation below is meant for the layperson who sees these terms pop up in places like web hosts' feature lists and the "System Requirements" lists for various web software like PHP scripts, and wonder what it means, and whether it's something that they need to be worried about. In other words, this guide is meant for a non-technical audience seeking to get the big picture and see if it is relevant to them.
(Note: if you're not sure what a web host is, you should read How to Make / Create Your Own Website: The Beginner's A-Z Guide for an explanation of this and other basic webmaster terms.)
What is a Database?
Before I can answer what MySQL means, I have to explain what a computer "database" means.
Essentially, where computers are concerned, a database is just a collection of data. Specialised (or "specialized" in US English) database software, like MySQL, are just programs that lets you store and retrieve that data as efficiently as possible.
A little analogy may help make it clearer why we use specialised database software. Think about the documents stored on your computer. If you were to save all your documents using a (brain-dead) file naming scheme like "
1.doc
", "2.doc
", "3.doc
", and so on, up to (say) "9,999,999.doc
", you will eventually face a problem of finding the right file if you're looking for a specific document. For example, if you're looking for a business proposal you made some time ago to XYZ Company, which file should you open? One way is to sequentially check every single file, starting from "1.doc
", till you get the right data. But this is obviously a highly inefficient method of getting the right file. And it's primarily the result of an inefficient method of storing your data (ie, saving your files) in the first place.
Now, this is of course a ridiculous example. I mean, no one I know saves files with names like these, and even if so, there are many search software that can help you locate the correct file without your having to manually open every single one in sequence. But it serves to make the point that once you have a lot of data, if you don't have a good system of organising it, finding the correct piece of data is a very time consuming operation. And it becomes more time consuming as the amount of data grows.
A database program is a type of computer software that is designed to handle lots of data, but to store them in such a way that finding (and thus retrieving) any snippet of data is more efficient than it would have been if you simply dumped them willy nilly all over the place. With such a database software, if you (say) keep a list of customers and their shipping addresses, entering and retrieving information about your one millionth customer will not take much longer (if at all) than entering and retrieving information about your first customer.
What is SQL? What is MySQL? What is PostgreSQL?
Many computer programs, including web-based programs like blogs, photo galleries and content management systems need to store and retrieve data. For example, blog software need to store the posts (ie, articles) you write, and retrieve them when a visitor goes to your site. Similarly, photo galleries store information about their pictures (for example, for sites that allow users to rate the photos, the numerical rating for each picture is stored in a database). Instead of reinventing the wheel and implementing their own system of storing and retrieving data, these software simply use the specialised database programs mentioned earlier.
To make it easy for other programs to access data through them, many database software support a computer language called "SQL" (often pronounced as "sequel"). SQL was specially designed for such a purpose. Programs that want the database software to handle the low-level work of managing data simply use that language to send it instructions.
There are many databases that support the use of SQL to access their data, among them MySQL and PostgreSQL. In other words, MySQL is just the brand of one database software, one of many. The same goes for PostgreSQL. These two databases are very popular among programs that run on websites (probably because they are free), which is why you often see one or both of them being advertised in the feature lists of web hosts, as well as being listed as one of the "system requirements" for certain web software (like blogs and content management systems).
Do I Need to Know Which is Better?
For the average webmaster, one who is not writing computer programs for their websites, the pros and cons of MySQL versus PostgreSQL or some other database are not important. All you need to be concerned about is whether your web host provides the database software that your web application needs. Generally, if you use one of the popular blogging software or CMS software, this will often be MySQL. In fact, since practically every commercial web hostprovides MySQL as part of one or more of its hosting packages, chances are that you probably don't even have to worry about this.
Do I Need It?
As mentioned in the previous section, if you use a blogging or CMS software (like WordPress, Drupal or Expression Engine), you will need to place your website on a web host that provides you with a MySQL database. The database will be used by the software to store all your posts (articles), web pages and visitors' comments.
If, on the other hand, your website was created using a web editor like Expression Web, Dreamweaver or BlueGriffon, and you did not integrate a blog or some other web-based software into your site, chances are that you don't need MySQL. In any case, if you're not sure, you can always check the "system requirements" page for the software that you want to use to find out whether you'll need MySQL.
(Before you ask, the feedback form generated by the Feedback Form Script Wizard does not need MySQL. Not all web-based programs require a MySQL database; only those that need to store data.)
Do I Need to Learn SQL or MySQL or Something Like That?
For the vast majority of webmasters, you don't need to learn SQL or learn how to use MySQL, even if you're setting up a blog. The software you use, be it WordPress or something else, will do all the dirty work of storing and retrieving your data for you. All you need to learn is how to use that particular software (eg, WordPress). Things like MySQL and other databases are like the engines of a car. Just as you don't need to learn how to design a car engine to be able to use a car, so also you do not need to know how to directly write to or read a MySQL database to use a blogging software.
Of course, if you are a programmer, intending to write a computer program that actually accesses MySQL or some other SQL database, then you will need to learn SQL (as well as a programming language). But then, if you are one, you probably already knew that. Note for the newcomer: you don't need to be a programmer to be a webmaster. Creating a website, even if you manually code your website directly in HTML, is not programming. So don't worry.
Other Relevant Articles
If you are reading this article to find out the meaning of these terms, chances are that you'll find the other articles listed below helpful in clarifying other terms frequently used in webmaster literature:
- How to Make / Create Your Own Website: The Beginner's A-Z Guide — this is a step by step guide on how to design your own website. It is written for the newcomer and is thus written in plain English (rather than webmaster-speak). Read it if you don't already have a website; it will answer a lot of your other questions as well as explain many important terms that you'll find everywhere, including "web host", "domain name", etc.
- What are HTML, CSS, JavaScript, PHP and Perl? Do I Need to Learn Them to Create a Website? — this article explains a few more cryptic acronyms used in the world of website making.
- What Does It Mean to Park a Domain Name? Domain Name Parking Explained — if you're puzzled by everyone talking about how you can park a domain name, read this article to find out more.
- Should You Choose a Linux or a Windows Web Hosting Package? Is There Such a Thing as a Mac Web Host? — web hosts usually tell you whether they are running Linux, FreeBSD or Windows. What's that all about?
There are undoubtedly many other terms that you have encountered as you go about setting up a website. If it's a common query, chances are that I also have an article on it somewhere on thesitewizard.com. You can either search for these using my internal search engine, check out the index of topics and categories, or simply peruse the site map. Since it's possible that I've organised information differently from the way you mentally categorise things (and perhaps even use different terms or spelling), if you can't find what you want using one of the above methods, try another.
Copyright © 2010-2017 by Christopher Heng. All rights reserved.
Get more free tips and articles like this, on web design, promotion, revenue and scripting, from https://www.thesitewizard.com/.
Get more free tips and articles like this, on web design, promotion, revenue and scripting, from https://www.thesitewizard.com/.
thesitewizard™ News Feed (RSS Site Feed)
Do you find this article useful? You can learn of new articles and scripts that are published on thesitewizard.com by subscribing to the RSS feed. Simply point your RSS feed reader or a browser that supports RSS feeds athttps://www.thesitewizard.com/thesitewizard.xml. You can read more about how to subscribe to RSS site feeds from my RSS FAQ.
Please Do Not Reprint This Article
This article is copyrighted. Please do not reproduce or distribute this article in whole or part, in any form.
Related Pages
- How to Point a Domain Name to Your Website (Or What to Do After Buying Your Domain Name)
- Should I Use a Temporary Domain Name Till My Preferred Domain Becomes Available?
- Is it Possible to Create a Website Without Buying a Domain Name? The High Price of "Free".
- Important Precautions to Take When Buying a Domain Name
- The Myth of "Unlimited" in Web Hosting
- Which Web Host Do You Recommend? (FAQ)
- Why Don't You Use the Keywords Meta Tag on Your Website?
- How to Customize Your 404 File Not Found Page
New Articles
- How to Make Text and Images into Clickable Links with BlueGriffon 2.x
- How to Change the Background Colour of Your Web Page in BlueGriffon 2.x
- What Should the Width of a Web Page Be?
- How to Move Your Website to SSL (ie, Convert from HTTP to HTTPS)
- How to Redirect a URL
- Does the Price of a Domain Depend on the Name Chosen? Why do Some Domains Cost So Much?
- Do I Need a Web Editor if I Create a Blog?
- Can you register a domain name directly with ICANN instead of through a middleman?
- How to Make a Mobile-Friendly Website: Responsive Design in CSS
- What's the Difference Between a Content Management System (CMS), a Blog, a Web Editor and an Online Site Builder?
Popular Articles
- How to Make / Create a Website: The Beginner's A-Z Guide
- Tips on Choosing a Good Domain Name
- How to Improve Your Search Engine Ranking on Google
- Expression Web Tutorial: How to Design a Website with Microsoft Expression Web
- Dreamweaver Tutorial: How to Design a Website with Dreamweaver CS6
- BlueGriffon Tutorial: How to Design a Website with BlueGriffon 2.x
- How to Design and Publish Your Website with KompoZer (free WYSIWYG web editor)
- Free Customized Feedback Form Wizard (PHP / Perl Script)
How to Link to This Page
It will appear on your page as:
***
Source: http://www.tutorialspoint.com/sql/sql-rdbms-concepts.htm
SQL - RDBMS Concepts
What is RDBMS?
RDBMS stands for Relational Database Management System. RDBMS is the basis for SQL, and for all modern database systems like MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
A Relational database management system (RDBMS) is a database management system (DBMS) that is based on the relational model as introduced by E. F. Codd.
What is a table?
The data in an RDBMS is stored in database objects which are called as tables. This table is basically a collection of related data entries and it consists of numerous columns and rows.
Remember, a table is the most common and simplest form of data storage in a relational database. The following program is an example of a CUSTOMERS table −
+----+----------+-----+-----------+----------+ | ID | NAME | AGE | ADDRESS | SALARY | +----+----------+-----+-----------+----------+ | 1 | Ramesh | 32 | Ahmedabad | 2000.00 | | 2 | Khilan | 25 | Delhi | 1500.00 | | 3 | kaushik | 23 | Kota | 2000.00 | | 4 | Chaitali | 25 | Mumbai | 6500.00 | | 5 | Hardik | 27 | Bhopal | 8500.00 | | 6 | Komal | 22 | MP | 4500.00 | | 7 | Muffy | 24 | Indore | 10000.00 | +----+----------+-----+-----------+----------+
What is a field?
Every table is broken up into smaller entities called fields. The fields in the CUSTOMERS table consist of ID, NAME, AGE, ADDRESS and SALARY.
A field is a column in a table that is designed to maintain specific information about every record in the table.
What is a Record or a Row?
A record is also called as a row of data is each individual entry that exists in a table. For example, there are 7 records in the above CUSTOMERS table. Following is a single row of data or record in the CUSTOMERS table −
+----+----------+-----+-----------+----------+ | 1 | Ramesh | 32 | Ahmedabad | 2000.00 | +----+----------+-----+-----------+----------+
A record is a horizontal entity in a table.
What is a column?
A column is a vertical entity in a table that contains all information associated with a specific field in a table.
For example, a column in the CUSTOMERS table is ADDRESS, which represents location description and would be as shown below −
+-----------+ | ADDRESS | +-----------+ | Ahmedabad | | Delhi | | Kota | | Mumbai | | Bhopal | | MP | | Indore | +----+------+
What is a NULL value?
A NULL value in a table is a value in a field that appears to be blank, which means a field with a NULL value is a field with no value.
It is very important to understand that a NULL value is different than a zero value or a field that contains spaces. A field with a NULL value is the one that has been left blank during a record creation.
SQL Constraints
Constraints are the rules enforced on data columns on a table. These are used to limit the type of data that can go into a table. This ensures the accuracy and reliability of the data in the database.
Constraints can either be column level or table level. Column level constraints are applied only to one column whereas, table level constraints are applied to the entire table.
Following are some of the most commonly used constraints available in SQL −
- NOT NULL Constraint − Ensures that a column cannot have a NULL value.
- DEFAULT Constraint − Provides a default value for a column when none is specified.
- UNIQUE Constraint − Ensures that all the values in a column are different.
- PRIMARY Key − Uniquely identifies each row/record in a database table.
- FOREIGN Key − Uniquely identifies a row/record in any another database table.
- CHECK Constraint − The CHECK constraint ensures that all values in a column satisfy certain conditions.
- INDEX − Used to create and retrieve data from the database very quickly.
Data Integrity
The following categories of data integrity exist with each RDBMS −
- Entity Integrity − There are no duplicate rows in a table.
- Domain Integrity − Enforces valid entries for a given column by restricting the type, the format, or the range of values.
- Referential integrity − Rows cannot be deleted, which are used by other records.
- User-Defined Integrity − Enforces some specific business rules that do not fall into entity, domain or referential integrity.
Database Normalization
Database normalization is the process of efficiently organizing data in a database. There are two reasons of this normalization process −
- Eliminating redundant data, for example, storing the same data in more than one table.
- Ensuring data dependencies make sense.
Both these reasons are worthy goals as they reduce the amount of space a database consumes and ensures that data is logically stored. Normalization consists of a series of guidelines that help guide you in creating a good database structure.
Normalization guidelines are divided into normal forms; think of a form as the format or the way a database structure is laid out. The aim of normal forms is to organize the database structure, so that it complies with the rules of first normal form, then second normal form and finally the third normal form.
It is your choice to take it further and go to the fourth normal form, fifth normal form and so on, but in general, the third normal form is more than enough.
No comments:
Post a Comment