Introduction to Data Management and Databases

12002

Course Introduction

This course primarily introduces the basic knowledge of data management and databases. We will start with the fundamental concepts of data management, first understanding data management tools, including files, spreadsheets, and databases, and comparing the similarities and differences between Excel and databases; then we will delve into the roles and types of databases, focusing on the commonly used relational database MySQL, and learning the basic concepts of SQL (Structured Query Language).

1. Data Management: Achieving CRUD Operations on Data

Concept of Data Management

Data management refers to the process of organizing, storing, processing, and accessing data. It involves operations such as adding, deleting, modifying, and querying data, aiming to effectively manage and utilize data.

You can think of data management as a library. In a library, you need a method to organize and find books, and data management serves as that method, but for digital information. Data management helps us collect, store, protect, and use data, just as librarians help us manage and borrow books.

Tools for Implementing Data Management: Files, Spreadsheets, and Databases

Data management can be achieved through various tools, commonly including files, spreadsheets, and databases. For small-scale data management tasks, such as simple documents or spreadsheets, tools like Word and Excel are sufficient. However, for large-scale data management, databases are a better choice.

Differences Between Excel and Databases

In the past, people were accustomed to using spreadsheet software like Excel to handle data. While Excel can manage simple data and calculations, its processing power and performance are limited compared to databases. Databases can handle large volumes of data, support simultaneous access by multiple users, and perform complex query operations, offering more robust data management capabilities and flexibility.

  • Use Cases for Excel:

Excel is suitable for small-scale data management and simple calculations, commonly used for data recording, analysis, and report generation by individuals and small teams. It features a user-friendly interface and functions, making it suitable for non-professionals to perform basic data processing.

However, establishing relationships between data in Excel is relatively limited. While formulas and functions can be used to manage relationships between data, these associations are based on cell-level, which restricts data interconnectivity; additionally, Excel lacks mandatory data validation and integrity constraints, which can lead to data conflicts and consistency issues when multiple users edit the same file simultaneously.

  • Use Cases for Databases:

Databases are suitable for large-scale data management and complex business requirements, such as customer management, inventory management, and online transaction systems in enterprises. Databases provide efficient data storage and access, support complex data queries and operations, meeting the data management needs of businesses.

Thus, databases have clear advantages in terms of data relationships and security. They offer more powerful data association and management functions, capable of handling complex data structures and query requirements. Furthermore, databases provide enhanced security features to protect data from unauthorized access and damage.

2. Understanding Databases

Concept and Role of Databases

A database is an organized repository for long-term data storage. It is like a huge electronic filing cabinet that offers persistent data storage, efficient data access and processing, data security, and integrity. Databases can store various types of data, such as user information, product data, and log records.

Types of Databases

Databases can be classified into different types, including relational databases, non-relational databases, and object-oriented databases. Among these, relational databases are the most commonly used type, organizing and storing data in tables with strict data structures and relationships. Many enterprises and applications use relational databases to store and manage data.

A relational database is a database system constructed through associations between tables. In a relational database, data is stored in the form of tables, each containing a set of related data, and different tables are connected through relationships. This structure allows relational databases to organize data more clearly, achieve structured storage and efficient querying, and address two key issues:

  1. Data cleanliness: Each table has clearly defined fields, ensuring data consistency and accuracy through the definition of table structures, field types, and relationships.

  2. Ease of data use: Relational databases use Structured Query Language (SQL), which allows users to easily perform CRUD operations on data.

Overall, relational databases, with their clear structure and powerful querying capabilities, have become the preferred data storage and management solution in many application areas.

Common Relational Database: MySQL

Some common relational database systems include MySQL, PostgreSQL, Oracle Database, and Microsoft SQL Server. These database systems use a structure of tables, rows, and columns, managing and querying data through SQL (Structured Query Language).

MySQL is an open-source relational database management system known for its high performance, stability, and wide range of applications. MySQL uses SQL as its operational language, allowing for easy data addition, deletion, modification, and querying.

3. SQL: Structured Query Language

Introduction to SQL

SQL (Structured Query Language) is a standardized language used for managing and manipulating relational databases, executing various database operations, including querying, inserting, updating, and deleting.

SQL is a declarative language; you only need to use it to perform operations without worrying about how they are implemented. You can think of it this way: just as you need to communicate in French with a French person, you also need to use SQL to communicate with a database to perform CRUD operations on data.

Basic SQL Operations: CRUD

SQL provides four basic operations: Insert (INSERT), Delete (DELETE), Update (UPDATE), and Select (SELECT). Through these operations, you can add, delete, modify, and query data in a database.

  • Querying Data (SELECT): Used to retrieve data from one or more tables. The SELECT statement is the most commonly used command in SQL, allowing users to specify the columns and conditions for retrieval.

  • Inserting Data (INSERT): Used to add new records to a database table. The INSERT statement allows users to specify the data to be inserted and the target table.

  • Updating Data (UPDATE): Used to modify existing records in a table. The UPDATE statement allows users to specify the columns to be updated, the corresponding new values, and the update conditions.

  • Deleting Data (DELETE): Used to remove records from a table. The DELETE statement allows users to specify conditions for deletion, removing records that meet those conditions.

4. Documentation Used in This Course

Tutorials: