0% found this document useful (0 votes)
3 views

Differences in SQL

The document outlines the key differences between relational and non-relational databases, highlighting aspects such as data models, transaction consistency, schema types, and data retrieval methods. It contrasts how each type handles rows, duplicates, and data modification, as well as their performance characteristics. Additionally, it discusses indexing and exception handling capabilities in both database types.

Uploaded by

Dhiraj Patil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Differences in SQL

The document outlines the key differences between relational and non-relational databases, highlighting aspects such as data models, transaction consistency, schema types, and data retrieval methods. It contrasts how each type handles rows, duplicates, and data modification, as well as their performance characteristics. Additionally, it discusses indexing and exception handling capabilities in both database types.

Uploaded by

Dhiraj Patil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Differences

Asked
in
SQL

Sakshi Yadav
Relational Non-relational

Various data models


Tables with rows and
(document, key-value, graph,
columns
columnar)

BASE (Basically Available,


ACID transactions Soft state, Eventual
consistency)

Structured schema Dynamic schema


Returns all rows from one
Returns matching rows from
table, matched rows from
both tables
the other

Excludes non-matching rows Includes non-matching rows

Includes LEFT JOIN, RIGHT


Common in equi-joins
JOIN, FULL JOIN

Used for precise data Used for comprehensive data


retrieval retrieval
Filters rows before grouping Filters groups after grouping

Used without GROUP BY Used with GROUP BY

Can use in SELECT, UPDATE,


Only in SELECT statements
DELETE

Applies to individual rows Applies to aggregated data


Removes duplicate rows Includes all duplicate rows

Slower due to duplicate Faster since it does not


removal remove duplicates

Combines result sets Combines result sets

Ensures unique results Allows duplicates


Removes rows
Removes all rows Deletes the entire
based on a
without condition table
condition

Cannot be rolled
Cannot be rolled
Can be rolled back back (in some
back
databases)

Slower, logs
Faster, minimal Fastest, removes
individual row
logging entire structure
deletions

Keeps table Keeps table Removes table


structure intact structure intact structure and data
Ensures uniqueness of the
Uniquely identifies each row
column values

Does not allow NULL values Allows NULL values

Only one primary key per Multiple unique keys allowed


table per table

Creates a non-clustered
Creates a clustered index
index
Fixed-length data type Variable-length data type

Padded with spaces for Stores only the characters


shorter values entered

Wastes storage for shorter More storage efficient for


values shorter values

Faster access due to fixed Slightly slower access due to


length varying length
Groups rows with the same
Sorts the result set
values

Used for aggregation Used for sorting

Follows the SELECT clause Follows the SELECT clause

Applies to the columns being Can apply to any column in


grouped the result set
Can modify data Cannot modify data

May or may not return a


Must return a single value
value

Limited or no exception
Support exception handling
handling

Can perform multiple Typically performs a single


operations operation

You might also like