Quiz

  1. Additionally, could you explain the client-server again? I'm still a bit confused on the structure - is there actual physical infrastructure (is that the server?) where the data is stored?

    Sure, I'm happy to do so. Yes, there are actual disk files where the data is stored, but in files and folders that are controlled by the server, not by the client. Think of it like the registrar, which controls your transcript.

  2. When you run a batch file with the command MariaDB [databaseName] > source batch.file.sql, do you need to write MariaDB [databaseName]?

    No; that's the prompt. I put it there to give you an idea of where to enter the command. This is a common presentational problem.

  3. Some code begins with $ mysql while some don't. Not sure about what's the difference.

    Again, that's the prompt. Some commands are unix commands, and some are MySQL commands.

  4. When using the MySQL client, why do only some commands end in a semi-colon/is there an easy way to remember which ones do and don't?"

    The database queries always end in a semi-colon, but commands for the database often don't. I've been doing this for 20+ years and I still sometimes forget to add a semi-colon. And it never hurts to put in an unnecessary one. I wouldn't worry about this.

  5. In what instances is it appropriate to comment on batch files? Does it depend on the complexity of the code, or are there specific instances to look out for?

    Commenting is always dependent on the complexity of the code. You should almost always give identifying info (author's name, maybe the date, etc) and the purpose or overall goal of the code. Then, explain any tricky parts of the implementation. The last part depends on the complexity.

  6. Does ORDER BY preserve the consistency of a row, or would it mix up rows unexpectedly?

    I'm not sure what you mean by "consistency." Do you mean is it a stable sort? "Stable" means that if row 13 precedes row 14, and we sort by some column for which row 13 and 14 are equal, then 13 still precedes 14 in the result. I think it is.

  7. What happens if you call ORDER BY on a different set of columns than you gave to SELECT?

    That works just fine. It sorts, and then reports the columns you want. Like sorting a spreadsheet and then hiding some columns.

  8. Do order by statements take long to run?

    MySQL uses a good sorting algorithm. So the complexity is...

  9. Is the correct to say the RDBMS usually can handle concurrent clients, whereas non-relational DBMS can never handle more than 1 client at a time? What exactly does relational mean?

    The lines are blurry. Both are designed for concurrent access, but they may have different guarantees for correctness. We'll talk about this again much later in the course.

    Relational means that the fundamental building block is a relation AKA a table.

  10. Why do you say ""WHERE birthdate IS NULL"" instead of ""WHERE birthdate = NULL""? When do you use ""IS"" and when do you use ""=""

    NULL is special. So whenever you care about NULL, you use different operators.

  11. I am a little confused about getting set up to use MariaDB, should it be in our cs304 folder we created last class?

    MySQL is not a file or a folder in your account. It exists elsewhere. We talk to it via the mysql client, which is a command that we run.

  12. When using the 'source' command to run a file, why does the output day ""database changed""?

    Because the first line of the batch file is a use statement, which changes what database you are in.

  13. I am also confused about the I/O redirection, why is the database not changed?

    Y'know, you're right. It *does* change, but the fact is not printed because of the way that the query is run. I'll fix the notes, and thanks for catching that.

  14. Is there a way to merge databases?

    Yes. If you need to, I can teach you how, but we probaby won't need to in this course.

  15. How does the wmdb treat movies with multiple directors?

    Great question. WMDB makes the assumption that movies don't have multiple directors. This is realistic without being completely true. (In the real world, most movies have just one director.) We'll talk more about this next time.

  16. Are we going to run queries outside of the terminal (like in a file)?

    Yes, many times.

  17. Is MySQL a specific type of SQL? Or do they refer to the same thing? Additionally, could you explain the client-server again? I'm still a bit confused on the structure - is there actual physical infrastructure (is that the server?) where the data is stored?

    There are many software implementations of relational databases: Oracle, DB2, Postgres, ... MySQL is one such. But they all speak the standard query language: SQL.

  18. Why do we have to interact directly with MySQL? Is there a python package that would let us do everything with databases at a higher level?

    We will use a Python package to interact with MySQL. Give us a few weeks. Oct 12th to be specific.

  19. How is the efficiency comparing to other similar data structures (ex. in pandas)?

    Efficiency is excellent. People have been working on RDBMS efficiency for 50 years.

  20. How do B-Trees work? / I want to learn more about the B-tree data structure.

    Y'know how binary trees work? That's a branching factor of 2. Imagine a branching factor of 100 or 200... They're really cool.

  21. "As disks get larger, being space-efficient has become less important, but space-efficiency can result in greater speed if less data needs to be moved from disk into memory or sent across networks. "

    This sounds like it aligns with the space-time complexity trade-off, but I'm having a hard time wrapping my head around why this is the case. Would you mind collaborating a bit more?

    It's similar to space-time tradeoff, but it's really more about saying that there's still a place for frugality. Don't store the number of children someone has in a 8-byte number when a 1-byte number will be more than enough.