Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why do we use database?

 
jim li
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

i have couple of questions about database:

1. in relational database such as ms access, mysql, oracle, why do we need to split database into different tables instead of putting everything in a single table, such as if we have student, teacher, employee., ect..

2. why do need to build a java web application to access database, instead of using database only.

please provide me some reference and links

thank you
 
Malatesh Karabisti
Ranch Hand
Posts: 153
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you are very new to the internet technology, Just think of the simple scenario Bank Applicaiton

As per your first quesiton let us put all Bank data in to one table called "Master" the data will be like customerName, Acc, LoanAcc, Saving Acc , CurrentAcc, and then branch, branchManager, headBrach, HeadBankManger, numberOfBranch, numberOfEmployees .... Do you think 1000 column are enough are we need more. this makes almost impossible to handle data thats why all data is divided into different table.

Second question why we java web applicaiton..
Just think you don't have web application for bank only thing you have is database. one fine moring you went to bank to deposite some amount. what the officer will do only with database he has to wright insert, update query. Every one in the earth won't know how to write query instead with web application he can enter the amount deposited and submit the form.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right that there is no "need" to build a web app to access a DB; a desktop app would work just as well (assuming it can be installed wherever it's needed). Prior to 1994 or so, no web apps existed at all, and the world was able to access its DBs just fine :-)
 
Malatesh Karabisti
Ranch Hand
Posts: 153
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya thats true NOT necessarily the Web applicatiion we need application to acces the database to make UI friendly.
 
Tuna Töre
Ranch Hand
Posts: 220
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:You're right that there is no "need" to build a web app to access a DB; a desktop app would work just as well (assuming it can be installed wherever it's needed). Prior to 1994 or so, no web apps existed at all, and the world was able to access its DBs just fine :-)


what a good period of time

Tuna TÖRE
 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why did people start accessing database using a web-app ?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rahul Sudip Bose wrote:why did people start accessing database using a web-app ?

People create web apps because they have certain advantages over desktop apps. And the web apps need access to the same data, obviously.
 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:
People create web apps because they have certain advantages over desktop apps. And the web apps need access to the same data, obviously.


What are the advantages and when does one prefer one option over the other ?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's keep this thread confined to the original topic.
 
chris webster
Bartender
Posts: 2407
32
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. in relational database such as ms access, mysql, oracle, why do we need to split database into different tables instead of putting everything in a single table, such as if we have student, teacher, employee., ect..


Because the tables represent the different entities, and the entities are essentially the "relations" that the "relational" model is built on, and you can then define relationships between them. You store the apples with the other apples, and the oranges with the other oranges, and so on. Of course, if you have several entities that have the same attributes and level of granularity e.g. you decide to just treat apples and oranges as "Fruit", then you can choose to store them as different sub-types in the same table.

But generally, if you put all your data in one big unstructured table, you don't have a relational database, you just have a mess (unless you're using a non-relational technology such as Amazon's or Google's "big tables", which have their own rules and restrictions). You wouldn't even design a spreadsheet that way - you'd put different kinds of data in different tables/sheets, wouldn't you?

This is not the place to launch into "Relational Databases 101", but relational DBs are based on a robust theoretical foundation about how to structure data for storage/access, and RDBMS implementations are massively optimised to support this approach, as well a providing lots of tools to help you do this. We've been using relational databases for about 30 years, and despite the appearance of alternatives (e.g. OO databases, Hadoop, BigTable etc), they're still performing pretty well for most mainstream applications. If you're planning to work in commercial IT, you'll be working with a relational database at some point, so it might be an idea to start learning about how and why they're used.

Data is not just a passive lump of bytes, it has its own rules and structures and behaviour, that you encode in your application and in table constraints, key relationships etc. So you write database applications to embody this behaviour and integrate it with your specific business processes for creating/manipulating the data as appropriate for your needs.

As for using a web application to access the database, that's essentially just a choice of user interface and a corresponding platform for that interface. But it's the underlying data and its internal logic/structure that are important, because these are the resources your organisation will still be using 10 years from now when today's cool new HTML5/JEE interface has long since been replaced with some other technology. That's why they call it a persistence layer, because data persists and - if you get it right - remains useful a lot longer than anybody expects.

Hope this helps!

Chris
 
jim li
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic