SQL is an industry-standard language. MySQL is some DBMS software that you can talk to using SQL. There are other implementations of a DBMS, such as Oracle, Postgres, IBM's DB2, and others.
A clause is a part of a statement. So
has four clauses, the capitalized keywords
When the CS server boots, a daemon process starts up that controls access to the data in the database. This process is called mysqld
, and it ends with a "d" because it's a daemon. (This is standard Unix terminology, not just databases. The Apache software runs as httpd
, because it's also a daemon.)
When we run the mysql
command, we start a second process (a client) that connects to the daemon (the server). When we type a SQL statement, our client sends it to the daemon, which executes it and sends back the results.
We might have a table of movies, a table of people, a table of production companies, a table of suppliers, a table of locations, a table of ...
Exactly right. So there might be a table of students, and a separate one of faculty, another of departments, another of vendors ...
In MySQL, a database is a collection of tables (usually related). The DBMS might manage lots of different databases.
We'll talk more about non-relational databases later in the course, once we understand joins and such. We'll get there!
Yes! That's called a "join" and we'll learn it next time!
Yes! Next Friday! Feel free to read ahead.
No. For efficiency, each item has the same representation. For dates, I'm pretty sure they are represented like Unix dates, which is the number of milliseconds since January 1, 1970. But the SQL language offers a ton of ways of formatting the dates (just like Python does). So in practice, if you want to search for dates that contain the string "ember", you could do that, by formatting the date value and then searching the string representation using wildcards.
yes. There are constraints on dates. No February 30th or January 32nd. This is a good thing, helping our data integrity.
Yes! September 17th. We'll get there soon.
Also Sept 17th.
Yes! This is a great idea. You can put several, even lots, of queries into a sincle batch file. That's really why it's called a "batch" file.
MySQL has a lot of datatypes. We'll learn about some on Sept 17th. But you can also look at MySQL data-types
Great question! They are similar in that they are text files that contain executable code in a particular language (SQL, Python). But there's is also a REPL (read-eval-print-loop) provided by implementation of SQL and implementations of Python. So why would you write a batch file? Because you want to write down (and debug) some code that you will run again later, or hand to someone else to run, etc.
It's a little like the difference between a live conversation and a document, that can be edited and re-read many times.
Personal preference, mostly.
When we run a batch file from the command line, the SQL interpreter prints the results in a different way, omitting many of the chattier messages. This will be useful when we want to run a batch file that prints some data, so that we can capture that data into an output file, like a CSV file. We'll do that in a few weeks. Until then, it's pretty much personal preference.
Oh, that's a great question, but let's leave it for another time, or maybe we can talk during office hours.