Tuesday, May 28, 2024
Tuesday, May 21, 2024
Intro to Databases Week 4
This week marks the halfway point of the course, and it's really flown by quick. I've really felt like I've learned a lot so far. There's obviously becoming more comfortable with SQL syntax, but there's also the understanding of what's going on behind each command as well. That's helped shed light on some of the real power of relational databases. Things that I previously thought must have been done all internally to a program, can actually be achieved with some simple SQL queries. I've also found learning about normalization very interesting, and both at times confusing and other times very easy to understand.
Things I'm still curious about are other database types like nosql, apache Cassandra, or elasticsearch. I'm beginning to understand how performance is affected by choices we make when designing our tables and queries, but there still seems like a lot of ground to cover there. Another question I have is around how does scaling and redundancy work for a database and keeping it all in sync. Also database heath, what are ways to make sure a database is sane and validated.
Tuesday, May 14, 2024
Intro to Databases Week 3
Someone described normalization rule as "a non-key column depends on the key, the whole key, and nothing but the key, so help me Codd." Key refers a primary or other candidate key of a table. If the key has multiple columns, then "whole key" means all columns together and not just some part of the key. Explain in your words what 3rd normal form is and why it is important.
Third normal form, to me, is when a key that does not need to be dependent on the table's index can be removed and made its own table. This helps with reliable and consistent data across the database.
What is an SQL view. How is it similar to a table? In what ways is it different?
A SQL View is essence a virtual table comprised of the results from a SQL statement. Basically the View isn't a table itself in the database, rather, it's composed of data from the database and structured in a way that makes sense for the moment. It's similar to a table, in the sense that you can query against the view, get data out of the view. However, unlike a table, it doesn't actually store any data in the the database.
Tuesday, May 7, 2024
Intro to Databases Week 2
- SQL has the flexibility to join tables on any column(s) using any predicate (=, >, < ). Most of the time the join will use equality between a primary and foreign key. Think of example where joining on something other than keys would be needed. Write the query both as an English sentence and in SQL. If you can't think of your own example, search the textbook or internet for an example.
- What is your opinion of SQL as a language? Do you think it is easy to learn and use? When translating from an English question to SQL, what kinds of questions do you find most challenging?