Quiz

  1. When running files using the mysql <  filename command, in case there was an error in the batch file, What would happen since it exits mysql immediately?Thanks.

    It will probably print an error message to the terminal before exiting. But you should definitely try this today!

  2. What does the phrase ":::SQL" mean?

    I apologize. There's some magic I put into our readings to say "format this code as SQL" but apparently I made a mistake in a few places and we got ugly unformatted code.

    Here's how it was supposed to look select statement

  3. Why is this query written like so: :::SQL SELECT name,birthdate FROM person; instead of: :::SQL SELECT name, birthdateFROM person;

    Let's look at examples of queries

  4. When using the WHERE clause, how does MySQL handle rows where the value is NULL?

    NULL is different from other things. So if we do

    
        SELECT *
        FROM A
        WHERE birthdate > '1961-05-06';
    
    
    And some birthdates are NULL, they won't get selected. And the same is true if we change the greater than to less than
  5. Will there be an error if we try to sort with NULL values?

    No error, but as you know NULL is different from other things, so it sorts to different places. Suppose we have a "birthdate" field and we sort it from lowest (oldest person) to highest (youngest person). Suppose some people didn't fill out that field and so the database stores NULL. Those people would all sort to a section of their own (either first or last, I don't remember).

  6. I'm actually a little bit confused about the difference between WHERE and HAVING. They both seem to filter rows, so when should I use one versus the other?

    That's common. Yes, they are both filters, but HAVING filters groups. For example, suppose we have some sales data. We can group them by region. Then we can filter out groups where the total sales of the region (group) is less than some value.

  7. Will we be using database viewers that are found in vscode? Also what are some uses of the data functions regarding database orginization?

    We won't be using database viewers, because I want people to practice the SQL language.

    I'm not sure I understand your second question.

  8. Can SELECT and WHERE also be used to select rows with certain column conditions?

    Not sure what you mean here. WHERE is always looking at column values, such as city or state or birthdate or ...

  9. I tried running the mysql interaction in my terminal by running the mysql command. I'm wondering why it didn't work?

    Not sure. We'll do that today, so ask again.

  10. My question is about what are the key differences between different SQL versions. I learned some sqlite3 before, and I'm wondering how it differs from MySQL. I have never used the use statement or <>, so I'll want to learn whether these examples and others are universal across the different variants or not. I also wonder what is the benefit of using the mysql interpreter over different applications to visualize databases like DBbrowser?

  11. I think I lack the intuition to iterate through the MySQL code. I believe that practice and exercises will help me more.

    For sure!