Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between JSON and SQL

Tags:

json

sql

I'm a newbie at web development, so here's a simple question. I've been doing a few tutorials in Django, setting up an SQL database, which is all good. I have now come across the JSON format, which I am not fully understanding. The definition on Wikipedia is: It is used primarily to transmit data between a server and web application, as an alternative to XML. Does this mean that JSON is a database like SQL? If not, what is the difference between SQL and JSON?

Thank you!

like image 878
Karnivaurus Avatar asked Feb 27 '14 14:02

Karnivaurus


Video Answer


3 Answers

JSON is data markup format. You use it to define what the data is and means. eg: This car is blue, it has 4 seats.

{
    "colour": "blue",
    "seats": 4
}

SQL is a data manipulation language. You use it to define the operations you want to perform on the data. eg: Find me all the green cars. Change all the red cars to blue cars.

select * from cars where colour = 'green'
update cars set colour='blue' where colour='red'

A SQL database is a database that uses SQL to query the data stored within, in whatever format that might be. Other types of databases are available.

like image 55
podiluska Avatar answered Oct 13 '22 00:10

podiluska


They are 2 completely different things.

SQL is used to communicate with databases, usually to Create, Update and Delete data entries.

JSON provides a standardized object notation/structure to talk to web services.

Why standardized?

Because JSON is relatively easy to process both on the front end (with javascript) and the backend. With no-SQL databases becoming the norm, JSON/JSON-like documents/objects are being used in the database as well.

like image 35
painotpi Avatar answered Oct 12 '22 23:10

painotpi


Absolutely not. JSON is the data format in order to pass the data from the sender to the receiver. SQL is the language used by relational databases in order to define data structures and query the information from them. JSON is not associated with any way to store or retrieve the data.

like image 36
Ashalynd Avatar answered Oct 12 '22 23:10

Ashalynd