Quiz

  1. Why is MySQL so commonly used compared to things like MongoDB or when would it be advantageous to use one over the other?

    Oh, we'll talk a lot about MySQL vs MongoDB later this semester. We have an entire class allocated to it.

    But, just a few words now: MySQL and other RDBMS (Relational DataBase Management Systems) have been around for decades. Every company uses one. Venerable, efficient and reliable. Still an extremely important part of the market.

    MongoDB and other NoSQL databases were invented in the last decade or so to address some issues of scaling RDBMS systems to huge databases (bigger than will fit on one server). So, pretty much only in that case do you choose NoSQL over SQL.

  2. Why can you not use MySQL in a database like MongoDB?

    They're different software, with different ways of organizing and managing the data.

  3. Is a SQL statement the same as a SQL query?

    Almost! If we are being pedantic, a "query" is something that retrieves (reads) information, while a "statement" create/updates/deletes. If you do both, you get "CRUD". Or maybe it changes something, like the use DB statement.

    Informally, the terms are interchangeable. People will say "please write a query that inserts a row..." and everyone understands what they mean.

  4. In the second method of using the shell, can you edit the actual database or is it just a copy of it?

    We will get to editing the database in a couple of weeks. That's also done with SQL statements, not with anything we've learned yet.

    But now is a good time to address a common misconception. The database is *not* in any of your files. Certainly not in any batch files. The batch file is just a way to write down a query so you can easily run it again. (Think about a weekly sales report for the boss.)

    If you really want the gory details, there *are* system files under /var/lib/mysql/ that allows the DBMS to restart after a reboot, but these are not relevant to us. We do not edit those files, except via the SQL statements that we will learn later.

  5. If i wanted to delete things from the table, what commands, and in what order, would I use? how would I avoid overwriting a batch file?

    I promise we'll get to that in a couple of weeks. Please be patient. But if you want to skip ahead, the lecture is on DDL, Sept 15th.

    As for not overwriting the batch file, the shell should prevent you, thanks to some settings that I just put in place because of your question.

    
    [cs304guest@dix ~]$ rm out
    [cs304guest@dix ~]$ python apple.py > out
    [cs304guest@dix ~]$ python apple.py > out
    -bash: out: cannot overwrite existing file
    
    

    This is the shell's "noclobber" setting. Very useful!

  6. How should we study SQL materials? Do you recommend flashcards?

    Just, practice, practice.

  7. I don't have any questions as of right now- just need to practice!

    Absolutely!

  8. I believe I will have some questions after I work more with MySQL!

    Keep 'em coming!