Jegan Babu
Jegan Babu

Reputation: 1396

difference between database and data structure?

The major operations we do are insertion,deletion and searching in any kind of data structure,which can also be done using database queries then what is the use of data structure?
which makes data structure unique from database?

Upvotes: 17

Views: 28518

Answers (8)

Maryam Ameen
Maryam Ameen

Reputation: 1

the main difference between database and data structure is that database is a collection of data that is stored and managed in permanent memory while data structure is a way of storing and arranging data efficiently in temporary memory. Overall, data is raw and unprocessed facts.

Upvotes: 0

user11144878
user11144878

Reputation: 1

Database is the conceptual view of storing data like excel sheets ,CSV files in data sets which stores data permanent in nature while data structure is the logical representation of storing of data into memory like array,graphs etc stores data into temporary nature wise.

Data Structure is the basic requirement for implementation of Data bases or data store.

Upvotes: 0

CKM
CKM

Reputation: 1971

IMO, Database is a term to refer to a collection of records which could be anything such as inventory data, user's data etc. Now, how do we store it on a computer is another technical issue. I can use linked list, array, tree, graph etc. to store my records depending on the usecase. Thus, data structure is a technical term given to these structures. In short, database is more of business term or folklore term and data structure is a technical term to refer to the collection of records.

Upvotes: 0

Dong Li
Dong Li

Reputation: 133

Data structure is a logical representation of how your data is organized. while database is a middleware to help you store the data into file system.

Suppose you are working in a social network company. Intuitively, the social network is a graph (data structure). You can apply graph algorithm here to solve practical problems. Meanwhile, the data in this graph must be persisted somewhere, so that you can read/write them. Instead of writing codes to save them into files, graph databases can help you there.

One is logical, the other is middleware (closely related to physical).

Upvotes: 0

user7338183
user7338183

Reputation: 1

Data structure is the memory and Database is Storage in computer. Data structure is voltile memory and database is non-volatile memory.

Upvotes: 0

Maaz Rehman
Maaz Rehman

Reputation: 694

At first it seems like a very stupid question , But really is not . The answers can turn your world upside down . (May be). So lets divide and conquer the question

Data Structure Loosely speaking,

“ A data structure is a specialized format for organizing and storing data. Any data structure is designed to organize data to suit a specific purpose so that it can be used according to needs, stored normally on RAM” -wikipedia

Database

“A database is an organized collection of data. It is the collection of database objects stored normally on hard disk.” -wikipedia

The Misconceptions

Well to be honest, It is a misconception that term data structure is applied to those structures that live in Ram, Not even close . Yes Normally Data structure resides in Ram(AKA Main Memory) but they can also live in Hard Disk(AKA Secondary Storage) . Stop being so Racist !!!!

The Similarities And the differences

Well database is nothing more than a collection of database objects that are stored in hard disk . A database management System uses a database for its own ends. To make my self perfectly clear, database objects here means schemas , tables, views , indexes , users etc There are so many database objects . Each object can be implemented using one or more data structures .

For Example a btree/btree+ index is implemented using Btree data structure. A hash based index obviously will use hash table to resolve key to an address. It is safe to say that Database is a collection of different data structures . These types can vary significantly based on technology and Operating System .

Upvotes: 3

Dong Li
Dong Li

Reputation: 133

Data structure shows how the objects in the problem is modeled and organized. For example,

  • Your shopping items are organized linearly into an array;
  • Your company's org chart is modeled in a tree;
  • Facebook connections are organized as a huge graph.

The problem which data structure solves is how to model the objects in real world logically so that we can solve the problem in a computational manner.

Database is about how the information is persisted. The data in data structure may be persisted into database if necessary and may not be.

Upvotes: 7

A database is a collection of tables (and possibly Stored Procedures, Functions, Views, etc.)

Let's keep it simple for now, though. Each table has a table structure that defines what can be placed in it. With No-SQL databases, this is different, as they are more loosey-goosey. Again, though, let's keep it simple for now.

A Database might be named anything, such as "Platypus" It can contain many tables, such as "DuckbillsInTheWild" and "DuckbillsInCaptivity" etc.

One of these tables may have the structure:

Name            Data Type
-------------------------
ID              int
Name            VarChar
Weight          Float
PoisonToeLength Float

Upvotes: 1

Related Questions