Jump to content

How do databases work?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic

#1
Sanoski

Sanoski

    Newbie

  • Members
  • Pip
  • 1 posts
Greetings, this is my second semester in college, and I'm taking some programming classes. I'm probably cheating by going ahead in the book and working through some of the projects, but the concept of databases really intrigues me.

I've done work with Excel. It seems like a very similar concept with SQL. Now when I throw SQL out there, don't be deceived. I really have no idea how to write SQL databases. For some weird reason I'm just interested in data. It seems like such a broad topic. Let me try and elaborate. Please tell me if I'm not clear. I'm not too schooled in the terminology yet, but I will try.

Here is where I'm confused. There appears to be two different realms of databases. The ones hosted online and private ones on a specific machine or LAN. Am I right so far? In theory there shouldn't be too much difference between them, except for implementation, the volume of data, and the amount of user access.

I assume now that most websites and lots of software applications utilize databases in some way or another. It wasn't until Computer Science 1 that I started thinking about these things. However, I am still unsure how this all comes together. Popular websites are usually dynamic. They aren't static. The website appears to grab information from somewhere that is constantly being updated. Where does this actual data come from?

Level with me here. I know this question could be answered a million different ways. I'm just looking for understanding. I feel like Rene Descartes. How is there any causal relationship? What is the connection? I hope I'm explaining this properly.

And a side question: This may or may not sound weird. Say I want to create some type of application that uses data online to make it more dynamic. I'm tired of making lame address books and calenders. If anything changes I have to physically update it myself. I want to write something that uses preexisting data that is updated somewhere. Like a news feed or something.

But I'm still not exactly sure I understand how this data is used by an application. Grabbing data from a web page seems unreliable. You'd have to know how the website is set up. XML has tags that I assume you could search and delimit in whatever programming language you're working with. But that means you'll need to understand the language you're using and XML. So should I start studying XML or SQL now, or what? I'm just not sure which direction to go. What would you propose?

#2
Guest_h4x_*

Guest_h4x_*
  • Guests
you want to write your own database, and you dont know how?
what you want to store in it, there are like a milion ways of doing it all depend of data types. your post is too long, im answering only to title.

follow this scheme:

table: name, address. name = name of table, addres = memory address of corresponding data (or array of addreses of addreses of data, if multiple storage allowed).

#3
Shaddix

Shaddix

    Programmer

  • Members
  • PipPipPipPip
  • 102 posts

Quote

I assume now that most websites and lots of software applications utilize databases in some way or another. It wasn't until Computer Science 1 that I started thinking about these things. However, I am still unsure how this all comes together. Popular websites are usually dynamic. They aren't static. The website appears to grab information from somewhere that is constantly being updated. Where does this actual data come from?

website usualy use a "mysql database", it's a very popular database because it's a good mix between being "light weight" (it can't be too hard on your computer since it is on the web), yet it has a big range of functionality, and it works very easy in combination with php (the most used language for dynamic websites)

for example this forum, when someone posts a topic a query adds the post (and topic if it's a new one) to the mysql database, also other things are added to the database, like who posted the post, postcound is incremented by 1 for the user,...

mysql is the database software like MS Access or Oracle , not a language, you can use standard sql to querry most DB Software

every time someone visits the website php querries the database and the result is shown, that's why a site is so dynamic

Quote

And a side question: This may or may not sound weird. Say I want to create some type of application that uses data online to make it more dynamic. I'm tired of making lame address books and calenders. If anything changes I have to physically update it myself. I want to write something that uses preexisting data that is updated somewhere. Like a news feed or something.

But I'm still not exactly sure I understand how this data is used by an application. Grabbing data from a web page seems unreliable. You'd have to know how the website is set up. XML has tags that I assume you could search and delimit in whatever programming language you're working with. But that means you'll need to understand the language you're using and XML. So should I start studying XML or SQL now, or what? I'm just not sure which direction to go. What would you propose?

that more or less depends on the form of the data you want to access

the easiest thing you could start to experiment with is a feedreader because there are tons of xml/rss-feeds like MOTORSPORTS news - autosport.com

you can use data from such feeds as input for your application

you can also connect your application to a database on a server, if you do that right your application will be held up to date with the information of the server

like if you would be able to access the database of a bank from your home you could make an application that calculates intrest and your application can get the intrest rate from the database, so you won't have to manually update the intrest when it changes, your app will always have the correct intrest (asuming the bank updates the database on a regular base)

there are also ways to convert a Mysql db to XML (example)

I think it's hard to find persons willing to make you able to access their database with their data, so maybe the best way to start experimentating would be to write software that process xml/rss news feeds, because you find those feeds on most newswebsites

but it won't be enough to only learn xml or sql, for the real cool things you need to use xml/sql in combination with a real programming language like php, java, vb, ...

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
The databases in common use these days are more or less the same, except for the small personal databases like Access. MySQL, SQLite, Oracle, Firebird, SQL Server, PostGRESQL, etc, etc, etc all work about the same, from a developer's perspective. You interact with them through SQL.

Ultimately, it just stores data. What kind of data you store, and how you organize it varies depending on the application you will be using and the requirements it has. Your question is sort of like: how would I use classes in C++, what kind of data can they store, etc? It all depends on the application.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
fredemc

fredemc

    Newbie

  • Members
  • Pip
  • 1 posts

Quote

There appears to be two different realms of databases. The ones hosted online and private ones on a specific machine or LAN.
There is no difference between an online database and a 'local' db, except that online versions can be accessed via the web. A database is a software application in which data is stored in a structured manner, and it runs on a computer. If the computer in question is a server w/ ports available to the outside, then it is online. A 'relational database' consists of 'tables' which is like your Excel spreadsheet FILE, and a table consists of 'fields', which are like the COLUMNS in a spreadsheet. Each field has a name. An addressbook table will have fields for first name, last name, street address, area code and so on. Each entry in the addressbook table is a ROW, which contains exactly one of each named field containing the data for each entry.

Quote

I am still unsure how this all comes together. Popular websites are usually dynamic. They aren't static. The website appears to grab information from somewhere that is constantly being updated.

A dynamic website is also a software application: it uses a programming language to access the data in the database. IOW, built into the website's run-time logic there must be code to open a communication stream to the db by passing it login info to initiate a 'session'. Then, once the session is established or opened, the website is programmed to 'query' or question the database to get back specific sets of data. [A query is a question. SQL means 'Structured Query Language'. It is the WAY you ask questions of many databases.] SQL is a vocabulary that the database understands.

So in a 'static' website, clicking a link may cause a 'page', which is actually just a static html file, to load. But in a dynamic site, clicking a link may instead execute a query. The query asks the db to return a set of data: for example if your address book is kept in a database, you will have 'fields' that contain each piece of data: first name, last name, , area code, phone # etc. You can write queries that say 'give me all first names' or 'give me all phone # from entries in the 91234 area code. When the data set you have asked for is returned, the web application reads throgh the data and processes it by reformatting it [usually wrapping it in HTML tags so the browser can read it], and teh reformatted data is set down to the user.

XML is like a database, but rather than storing data in a software application, XML is just a text file. The data in XML is stored in elements that look like html tags. The benefit of XML is that it allows 'child elements' to be nested beneath 'parent' elements, so it allows hierarchical relationships between bits of data to be represented very easily. Relational databases are not good at that. [Neither is Excel.]

Finally, there is another type of database gaining popularity that is not a relational database, but instead stores XML documents. This is really good, because they have the speed of a database but handle the hierarchical relationships too. This is how big content management systems are built.

XML is very easy to learn. Jump right in. And yes, learn it, because it is going to be the way data is stored in the future. Here is a resourse that may help: See EMC's XML Tech web site at community.emc.com and click the XML Technologies link

And don't forget the great folks at W3Schools, who put up online tutorials for everything under the sun. w3schools.com

#6
sdavis2702

sdavis2702

    Learning Programmer

  • Members
  • PipPipPip
  • 93 posts
Fredemc you should get paid a small check for that post lol. That was very helpful to a guy like me who is a beginner. Though I knew all of that, it was because I drew my own conclusions. You just confirmed everything I thought... which gives the confidence to EXPECT certain things from what I try to build.

Good job on that post!
My Name is Sean and I like codes and stuff...
NoobJunction.com | SuccessOnMyMind.com | ArmedForcesCarClub.com

#7
ZekeDragon

ZekeDragon

    Writes binary right handed and hex left handed

  • Moderators
  • 2,103 posts
I propose that be the forum's best first post.
Wow I changed my sig!

#8
Keith2009

Keith2009

    Newbie

  • Members
  • PipPip
  • 10 posts
i have to write 10 posts in order to be able to PM someone.