[ Today's entry could be subtited » The Database Room. ]
Easy to confuse the term 'database' with the software that runs one .. which is actually a 'RDBMS' » Relational DataBase Management System. I've used the term 'database' myself (many times) when what I actually meant was » RDBMS.
Of course, I am FAR from being a database guru. (N00b is more like it.) But from what I can see, DATABASES look pretty cool (*).
The 'relational' part seems to refer to TABLES, which can be 'related' to one another, in any way you like, but only when you explicitly specify the relation.
The database for the Drupal CMS, for example, contains 68 'related' tables. Bigger and more complex applications tend to have more tables. ]
(*) My background contains some mechanical engineering, so that's what I tend to use as a conceptual point of reference. It happens on its own. Here's what I see (» a physical analogy):
»» The Database Room
A good-sized ROOM. I call this » The Database Room. It's empty except for BOOKCASES .. on 3 of the 4 walls .. BOOKCASES that run both wall-to-wall & floor-to-ceiling .. all divided into many perfectly square little cubes.
The only other thing in the room sits mounted to a circular pedestal in the center » a big, shiny, mechanical ARM (made of Inconel stainless-steel) .. which both deposits-items-into & retrieves-items-from the bookcase .. which it does both quickly & efficiently.
Running into the room from the outside is a conveyor belt. (Black, of course.) The conveyor runs both to & from the big mechanical arm. Deftly the arm grabs packages from the conveyor and places them into their designated boxes/cubes (.. in the bookcase). It also retrieves requested packages from other cubes and places them on the outgoing conveyor.
••• today's entry continues here below •••
The tops & left-sides of all bookcases (tables) are labeled as part of a grid (.. like a spreadsheet). Columns go up & down. Horizontal rows are called 'records'.
Each wall (bookcase) is a 'table'. A table can contain as many columns & rows (records) as you like. Each table has a different name (.. located at the very top, centered), as does the label for each column heading.
The walls spin around (like in a scary movie) such that you can have as many different tables as you want. Magical gnomes on the other side of the walls/bookcases swap out tables often as necessary.
[ This is admittedly the hokiest part of my analogy .. point being » there are no limits to the number of tables a database can contain. At least, none you'll bang up against in this lifetime. ]
Each database gets its own room. Different room = different database. And there's a sign on the door, which is the NAME of the database. The password is the key that opens the door to the database room.
Every database has a KEY (password), and programmers take steps to ensure bad people can't get 'hold' of it (.. such as protecting with .htaccess files).
The language we use to instruct this mechanical arm .. is called ( drum-roll ) » SQL ("ess-kyu-ell" or "sequel") aka » Structured Query Language, which is simple, but can be used to compose some very sophsticated queries.
Learning how to get jiggy with these SQL queries seems to be a major part of learning to program with PHP. [ SQL commands are usually written in ALL_CAPS by convention (syntax), even tho SQL itself is NOT case sensitive. ]
Cool thing about the PHP scripting language is that it will pass your SQL commands to your MySQL database (.. using the mysql_query command), and retrieve the results (.. using the mysql_fetch_array command).
Very cool, indeed. This PHP does remarkably well. Almost as if it were created for this very purpose (.. of working with databases).
If my analogy is valid, the actuator arm = the RDBMS, and the conveyor belt = PHP, or the part of PHP that shuttles SQL code into and query RESULTS out-of the RDBMS. The bookcase-covered rotating walls manned by gnarly gnomes = TABLES, which, when taken together = your DATABASE.
[ If I've made any GCE's, pls lemme know. (gce = gross conceptual error.) ]
This idea, of how a database works, just popped into my head a few days ago .. much in the way most anything you study becomes increasingly clear and begins to take form. It's like you can almost reach out and touch it some times.
Used to be (for me) a DATABASE was a tiny point, a speck .. way 'over there.' A mysterious little speck in the distance. Now it's a room I can walk into. =)
Using both PHP and MySQL together is definitely more complicated than using either program separately. In nuclear terms, putting two things together is called .. fusion. It's what the sun uses to create heat (.. energy we can feel some 93 million miles away).
I'm starting to get a glimpse of the power available and it seems unlimited, for all intents & purposes.
[ Reactors btw, use fission, which is the process of breaking a single atom into 2 smaller parts. Fusion (the sun) delivers far more energy than fission, yet requires an enormous energy input to get the process going. ]
Interesting how websites that employ a combination of both PHP & MySQL .. are usually termed 'database-driven' .. suggesting the 'database' part (MySQL) is more important than the PHP part.
I've previously had the impression that a major part of PHP's job is to shuttle SQL code (queries) to a database and retrieve (fetch) its results. All else seems secondary.
»» Nectar Day
Thursday was one of those picture perfect days of summer .. for which southern California is famous. Back when I lived down in San Clemente (not far from here), the city's motto was » Worlds Best Climate. Yeah.
Even by SoCal standards, Thursday was a delicious day. Felt like God was smiling. Everybody was in a good mood. Mighta been the cherriest day ever (.. I had the Bug.) .. and that includes the years I lived in Hawaii.
»» Little Hackers
But the bad bunny (who stole their ice cream cone at the beginning) does not die easily. No.
Have to kick the snail shell into the bunny .. to kill him. But if the bunny jumps on you, it's very bad.
Funny how a big group of kids will all want to play the same game, so they can work together .. to help each other.
I'm talking about what I see at the library (.. where they have a dozen PCs dedicated solely for kids' use).
The kids help each other. When one gets stuck, others comes to his aid. Older kids help younger ones. Remarkable to see in action. The hacker-like, goal-oriented cooperation .. at such a budding young age. =)