SQL vs NoSQL, Structured Query Language (SQL)
More rigid and structured way of storing data
Consists of two or more tables with columns and rows
Relationship between tables and field types is called a schema
A well-designed schema minimizes data redundancy and prevents tables from becoming out-of-sync.
NoSQL: Not only SQL
Greater flexibility than their traditional counterparts
Unstructured data from the web
NoSQL databases are document-oriented
Ease of access
4. WHAT IS A DATABASE?
A database is a set of data stored in a computer. This data is usually structured
in a way that makes the data easily accessible, and organizes the data in the
form of tables, views, schemas, reports etc.
Database Management System: The software which is used to manage
database is called Database Management System (DBMS) For Example,
MySQL, Oracle etc.
5. WHAT IS A RDBMS?
A relational database management system (RDBMS) is a program that allows
you to create, update, and administer a relational database. Most relational
database management systems use the SQL language to access the
database.
A relational database is a type of database. It uses a structure that allows us to
identify and access data in relation to another piece of data in the database.
Often, data in a relational database is organized into tables.
WHAT IS A RELATIONAL DATABASE?
8. • Structured Query Language (SQL)
• More rigid and structured way of storing data
• Consists of two or more tables with columns and rows
• Relationship between tables and field types is called a schema
• A well-designed schema minimizes data redundancy and prevents tables from
becoming out-of-sync
• fit naturally into many venerable software stacks, including LAMP and Ruby-
based stacks
9. CREATE: to create a database and its objects like (table, index, views, store
procedure, function, and triggers)
ALTER: alters the structure of the existing database
DROP: delete objects from the database
TRUNCATE: remove all records from a table, including all spaces allocated for
the records are removed
COMMENT: add comments to the data dictionary
RENAME: rename an object.
DDL: is short name of Data Definition Language, which deals with database
schemas and descriptions, of how the data should reside in the database.
Example: CREATE, ALTER,DROP, TRUNCATE, COMMENT, RENAME etc.
10. DML is short name of Data Manipulation Language which deals with data
manipulation and includes most common SQL statements such SELECT,
INSERT, UPDATE, DELETE, etc., and it is used to store, modify, retrieve,
delete and update data in a database.
SELECT: retrieve data from a database
INSERT: insert data into a table
UPDATE: updates existing data within a table
DELETE: Delete all records from a database table
MERGE: UPSERT operation (insert or update)
EXPLAIN PLAN: interpretation of the data access path
LOCK TABLE: concurrency Control
12. • MySQL
• Oracle
• IMB DB2
• MS SQL Server
• PostgreSQL
• Sybase
• Microsoft Azure
13. • Not only SQL
• Greater flexibility than their traditional
counterparts
• Unstructured data from the web
• NoSQL databases are document-oriented
• Ease of access
16. SQL NOSQL
• RELATIONAL DATABASE
MANAGEMENT SYSTEM (RDBMS).
• These databases have fixed or static
or predefined schema.
• These databases are not suited for
hierarchical data storage.
• Non-relational or distributed
database system.
• They have dynamic schema.
• These databases are best suited for
hierarchical data storage.
17.
18. DATABASE SCHEMA
• A database schema is the skeleton structure that represents the logical
view of the entire database. It defines how the data is organized and how
the relations among them are associated. It formulates all the constraints
that are to be applied on the data.
• A database schema defines its entities and the relationship among them.
It contains a descriptive detail of the database, which can be depicted by
means of schema diagrams. It’s the database designers who design the
schema to help programmers understand the database and make it
useful.
19.
20. A database schema can be divided broadly into two categories −
•Physical Database Schema − This schema pertains to the actual
storage of data and its form of storage like files, indices, etc. It defines
how the data will be stored in a secondary storage.
•Logical Database Schema − This schema defines all the logical
constraints that need to be applied on the data stored. It defines tables,
views, and integrity constraints.
21. SQL NoSQL
• Ensure ACID compliancy
• Data is structured and
unchanging.
• Do not make the most of cloud
computing and storage
• SQL databases are best suited
for complex queries.
• Do not comply
• Data is un-structured and
changing
• Make the most of cloud
computing and storage
• NoSQL databases are not so
good for complex queries
because these are not as
powerful as SQL queries.
23. Atomicity: All changes to data are performed as if they are a single
operation. That is, all the changes are performed, or none of them are.
For example, in an application that transfers funds from one account to
another, the atomicity property ensures that, if a debit is made
successfully from one account, the corresponding credit is made to the
other account.
Consistency: Data is in a consistent state when a transaction starts
and when it ends.
For example, in an application that transfers funds from one account to
another, the consistency property ensures that the total value of funds
in both the accounts is the same at the start and end of each
transaction.
24. Isolation: The intermediate state of a transaction is invisible to other
transactions. As a result, transactions that run concurrently appear to be
For example, in an application that transfers funds from one account to another,
the isolation property ensures that another transaction sees the transferred funds
in one account or the other, but not in both, nor in neither.
Durability: After a transaction successfully completes, changes to data persist
and are not undone, even in the event of a system failure.
For example, in an application that transfers funds from one account to another,
the durability property ensures that the changes made to each account will not
reversed.
25. Application of SQL and NoSQL
• SQL Application:
Data need to be structured as in Bank database, University
Database, Company’s database, etc.
• NoSQL Application:
Lots of unstructured data as in Social blogs like WordPress,
Facebook, twitter, Instagram, etc.
27. In a DBMS, a stored procedure is a set of SQL statements with an
assigned name that's stored in the database in compiled form so that it
can be shared by a number of programs. for simple, Stored
Procedure are Stored Programs, A
program/function stored into databaseCREATE PROCEDURE <owner>.<procedure
name>
<Param> <datatype>
AS
<Body>
A benefit of stored procedures is that you can centralize data access
logic into a single place that is then easy for DBA's to optimize. Stored
procedures also have a security benefit in that you can grant execute
rights to a stored procedure but the user will not need to have read/write
permissions on the underlying tables. This is a good first step against
SQL injection.