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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
db provides a very different interface and structure than SQL-based databases, and that involves thinking about things differently. Depending on what you need, either might be a good design decision. Generally, SQL databases tend to be more engineered, with all sorts of nice features like scalability, security, and easy running of complex queries. If your data isn't quite flat, then SQL databases are an excellent match. However, they are more complex than the db, and if all you're trying to get is some form of persistant data, then they're probably the wrong solution.
SQL databases are table-driven, whereas dbfiles are best thought of as being like a perl hash. If you're trying to model several things that have structured relationships between each other, perhaps data about employees, positions, salaries, offices, and dependants, storing information both about the individual things and links between them, SQL is great for that. You could easily write a query that finds employees from the boston office with 2 kids who make less than $40k/yr.
SELECT EMPS.empid FROM EMPS,PAY,OFFICES,DEPS WHERE EMPS.empid = PAY.empid AND PAY.sal < 40000 AND EMPS.locid = OFFICES.depid AND OFFICES.name = 'Boston' AND 2 = (SELECT COUNT(*) FROM DEPS WHERE DEPS.parentid = EMPS.empid);
It's possible to model this kind of stuff in dbfiles, of course, but it likely will be slower, and doing queries will be a pain. Some of the advanced features in SQL databases, such as nice backup, replication, BLOBs (storing arbitrary files in the database in a column), and similar can be really nice. The downside to SQL is that it requires more thought, and if you don't want to spend the time writing your queries or designing tables, it's definitely not for you.
In sum, you can think of SQL as being like a nice car, and file db as being like a bike. Their purposes arn't entirely the same, cars are more powerful and essential for some purposes, but require entering a certain frame of mind, and their features are overkill if all you want to do is ride around the neighborhood. I hope this helps..

In reply to SQL vs file-db by Improv
in thread MySQL,, OR normal DB! by ACJavascript

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others rifling through the Monastery: (5)
    As of 2024-09-09 21:13 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?
      erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.