Posts

Showing posts from October, 2025

sql final journal

Throughout this course, I’ve learned how powerful and structured SQL really is when it comes to managing and organizing data. The three most important things I learned are how to design databases properly , how to write and understand complex SQL queries , and how databases maintain data integrity and performance behind the scenes . The first major thing I learned was database design . I now understand how to use CREATE TABLE statements, define primary and foreign keys, and build relationships like one-to-many or many-to-many. Learning about normalization and entity-relationship (E-R) diagrams showed me how to organize data efficiently, avoid redundancy, and make sure every table serves a clear purpose in the overall schema. The second thing I found essential was writing advanced SQL queries . I learned how to use SELECT statements with joins, grouping, and functions like SUM , COUNT , AVG , and MAX . Understanding the difference between WHERE and HAVING clauses, as well as how to ...

week 7 journal sql

This week, I learned about the differences between MongoDB and MySQL, and it really helped me understand how each database fits different situations. Both systems are used to store, manage, and retrieve data efficiently. They also support indexing, replication, and backups, which help improve performance and reliability. The biggest difference I noticed is that MySQL is a relational database , while MongoDB is NoSQL . MySQL uses tables, rows, and columns with a fixed schema, and data is connected through relationships like foreign keys. MongoDB stores data in flexible, JSON-like documents , which don’t need a predefined structure. Because of that, MongoDB feels more adaptable for projects where the data might change often. If I had to choose between them, I’d use MySQL for projects that need strong consistency and clear relationships, like a student database or an online store. On the other hand, I’d use MongoDB for apps that need to handle a lot of unstructured or changing data, l...

week 6 sql journal

This week, I learned how to bridge SQL with real-world applications by running database operations directly through Java using Connector/J . It was really interesting to see how concepts like DriverManager , Connection , Statement , and PreparedStatement come together to let a program communicate with a database. I practiced creating connections using the try-with-resources syntax so that connections automatically close, which helps prevent memory leaks or hanging sessions. I also learned how to handle NULL values , retrieve auto-generated primary keys , and manage transactions using commit() and rollback() . Using PreparedStatements stood out to me because they not only make the code more efficient when executing similar SQL statements multiple times but also protect against SQL injection attacks , which is a huge part of writing secure applications. In the lab, we applied these ideas by designing a pharmacy database that tracks patients, doctors, prescriptions, and drug data....

week 5 journal index

  Indexes are designed to speed up queries by allowing the database to quickly locate rows without scanning the entire table. However, as the author explains, there are situations where an index lookup can still be slow , even though an index is being used. The term slow index doesn’t mean the index is broken or “degenerated.” Instead, it refers to the extra work the database must do after the initial tree traversal . Once the database finds the right index entries, it may need to follow the leaf node chain to locate all matching values, and then fetch the corresponding table rows , which are often scattered across many blocks. These additional steps can require many reads from disk, slowing down performance. In short, a “slow index” happens not because the index is damaged, but because retrieving the actual data involves extra I/O operations. The author emphasizes that rebuilding indexes doesn’t fix this—real performance issues come from how data is accessed and distributed, ...