Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: OT: SQL and me

by trippledubs (Monk)
on Sep 28, 2013 at 05:37 UTC ( #1056099=note: print w/ replies, xml ) Need Help??


in reply to OT: SQL and me

I think there is an easier way to visualize it. Tables don't contain other tables. A table is like a piece of paper. If you were to manually write out what a relational database does, you would be looking at three pieces of college ruled paper side by side.

band_members ############################################################# ID First Name Last Name ############################################################ 1. Paul McCartney 2. Ringo Starr 3. George Harrison 4. John Lennon band_members_and_Bands_linking_table ########################################################### band_members_id bands_id ########################################################### 1 1 2 1 3 1 4 1 3 2 4 3 1 4 1 5 4 5 3 5 Bands ######################################################### ID Band Name ######################################################## 1. Beatles 2. Traveling Wilburys 3. Plastic Ono Band 4. Wings 5. Solo
That is pretty much it. If this example is any good, you are already visualizing and tracing the relationships between the data.

SQL is fun to learn, because there are only three commands. select, delete, and insert. There is 'update' if you really want to get fancy and combine delete and insert into a single statement. I would not try to Perl and SQL at the same time. I recommend the Head First SQL book, that will probably teach you all you want to know, if you want to go further, I like the MySQL certification book. You could combine those three tables into one, but this style is preferred, because it makes it harder to learn and raises the barrier to entry for Database Administrators. enhances performance


Comment on Re: OT: SQL and me
Download Code
Re^2: OT: SQL and me
by parv (Priest) on Sep 28, 2013 at 06:36 UTC
    If you are going to invoke "performance", DELETE-INSERT is inefficient, & bug inducing simply by virtue of being two operations, than UPDATE.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1056099]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2014-10-22 22:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (122 votes), past polls