Introduction to Databases PDF
Document Details
Uploaded by Deleted User
Tags
Summary
This document provides an introduction to databases, including basic concepts, relational databases, and an introduction to SQL. It covers the evolution of databases and different database management systems. It also details the architecture levels in databases.
Full Transcript
Introduction to Databases 1 Semester. 2nd IBM + IR Topic 1: Basic concepts 2 Topic 2: Relational databases 6 Topic 3: Introduction to SQL 9 Topic 1: Basic concepts Understa...
Introduction to Databases 1 Semester. 2nd IBM + IR Topic 1: Basic concepts 2 Topic 2: Relational databases 6 Topic 3: Introduction to SQL 9 Topic 1: Basic concepts Understanding databases is essential as they are found in all aspects of today's digital world, facilitating efficient data management in different industries, such as: - E-commerce platforms - Social Media - Banking and Financial Services - Health Systems - Educational institutions - Logistics & Supply Chain Management - Customer Relationship Management (CRM) - Government Services Evolution of databases Before databases, the methods for storing and managing information were very limited, including: - Paper - Magnetic tapes - Accounting Books and Records - Electronic Files and Directories The limitations they posed involved difficulty in search and retrieval, lack of integrity and security, or the inability to handle large volumes of data. Development over the years: ➔ 1970 Decade ◆ Introduction of the Entity-Relationship model as a standard tool for database design. ◆ Oracle introduces the first RDBMS. ➔ 1980s ◆ IBM creates SQL and it becomes the standard language. ◆ More companies creating RDBMS, such as Sybase, which introduces the first Microsoft SQL Server. ➔ 1990 Decade ◆ NoSQL databases begin to handle unstructured data ◆ Data warehousing and data mining appear. ➔ 2000s ◆ Open source databases. ◆ High-volume database products ◆ DataLake concepts ◆ Cloud databases and serverless solutions. Key Concepts ➔ Database: It is a collection of interrelated data that is organized and stored in a way that can be easily accessed, managed, and updated. It consists of tables, which contain rows and columns where data is stored and related to other tables through relationships. They can store information about people, products, orders, etc. Many databases start out as a list in a spreadsheet or word processing program, but as the list grows, data redundancies and inconsistencies begin to appear. It is becoming increasingly difficult to understand data in list form, and methods of searching or extracting subsets of data for review are limited. Once these problems start to appear, it's a good idea to transfer the data to a database created with a database management system → DBMS. ➔ Database Management System (DBMS): It is a software designed to manage databases, providing functionalities to define, create, query, update and manage databases. It acts as an interface between users and the database, ensuring efficient storage, retrieval, and manipulation of data, while maintaining data integrity and security. Example: Oracle database, Microsoft SQL Server, MySQL, etc. Architecture Levels in Databases One of the main goals of database management systems is to provide users with a simplified view of data, hiding the complexities of how data is stored and managed. There are three different levels of abstraction that go from highest to lowest abstraction: Conceptual design: It is the highest level of abstraction, defining major entities and relationships in a way that is technology-agnostic, meaning that it is not tied to or dependent on any specific technology. It is designed to work universally, regardless of the database system or technology used in the future. Logical design: It is detailed but still abstract, specifying tables, columns, and relationships, ready to be assigned to a specific database management system. Physical design: It describes how data is actually stored, it is the lowest level of abstraction. Conceptual Design Logical design Physical Design Level of abstraction The highest level of More detailed than the It focuses on the abstraction provides a conceptual model, but actual deployment high-level view of the still independent of the details of how the data data physical will be stored and implementation accessed Level of detail Define the overall Define the logical Physical storage structure of the structure of your data, fabrics, indexing, database without including tables, partitioning, and going into detail about columns, data types, performance how it will be and relationships optimization implemented Purpose To capture major To provide a detailed To optimize storage entities and blueprint that can be and access to the relationships in a way used to deploy the specific requirements that is independent of database to a specific and constraints of the any specific DBMS or DBMS chosen DBMS technology Audience Usually for business For database For database stakeholders and designers and administrators and database designers to developers to plan developers who are agree on the overall how the database will deploying and structure and be structured converting the requirements database Example Define entities such Define tables such as Specify how the as "student," "course," "students", "courses" "Students" and and "teacher," and the and "teachers", "Courses" tables will relationships between specify columns such be stored on disk, them, such as as "studentID", including storage "enrollment" and "coursename", format options, "teaching" "professorID" and indexing methods, detail foreign keys and and partitioning of other constraints physical data. Importance of databases in economic and financial analysis It provides a structured way to store data related to markets, transactions, financial records, etc. Organize data into easily accessible formats for data analysis, reports, predictions, etc. Facilitate informed decision-making, identify trends, and make accurate forecasts. Maintain the accuracy and confidentiality of confidential financial information. Database Management Tools & Software They are applications that help users create, manage, and manipulate databases. They provide an interface to interact with data and perform various operations such as queries, updates, and reports. Example: MySQL is used as a database management system and MySQL Workbench is used as a tool to learn more about databases because it is free, simple, and easy to install. Functions: 1. Storage → large volumes in a structured format 2. Query → recovery capabilities using languages such as SQL 3. Manipulation → insertion, update and deletion 4. Integrity → accuracy and consistency across constraints, validation rules, and transactions 5. Data security → protection with user authentication 6. Backup & Recovery → offers tools for data backup and recovery 7. Performance optimization → includes features such as indexing, caching, and query optimization for better performance. Topic 2: Relational databases Relational databases are a type of database that stores and provides access to data points that are related to each other. Tables: ○ Each table represents a specific entity → customers, orders, products, and so on. ○ Tables are the fundamental structure for storing data in a relational database. ○ The data is organized into tables, which consist of rows and columns. ○ Each table has a unique name and contains rows (records) and columns (fields) ○ The columns define the attributes of the entity, and the rows contain the data instances. Register: they are contained in tables, they are rows. Field: they are contained in tables, they are columns that make up the records. Relations: ○ Relationships in a database are essential for linking tables to enable complex queries and ensure data integrity. ○ Relationships are established through keys → primary keys and foreign keys ○ Primary key: One primary key is a column or set of columns of A table that uniquely identifies each row in that table. Example: In a Customers table, CustomerID can be a primary key because each customer has a unique ID. Foreigner key: A foreign key is a column or set of columns in a table that uniquely identifies a row in another table. Establishes a link between the data in the two tables. Example: In an Orders table, CustomerID can be a foreign key that references CUstomerID in the Customers table. Importance of relationships ➔ Data integrity: Ensures data consistency and accuracy, foreign key constraints prevent invalid data from being inserted. For example, preventing an order from referencing a non-existent customer. ➔ Efficient Data Recovery: Allows complex queries to retrieve related data across multiple tables. For example, join the Customers and Orders tables to find out which customer placed which order. ➔ Reduced data redundancy: Eliminates the need to duplicate data by storing related data in separate tables. For example, storing customer details once in the Customers table and referencing them in the Orders table. Entity-Relationship Diagrams - Conceptual in Relational Databases Entity-relationship diagrams (ER) are a crucial tool in database design, they are used to ➔ Entity identification: ER diagrams help identify entities, attributes of these entities, and the relationships between entities. ➔ Relationship definition: Defines relationships between entities, such as one-to-one, one-to- many, or many-to-many relationships. This is essential for understanding how different entities interact with each other. ➔ Normalization: Normalization reduces data redundancy and improves data integrity when organizing fields and tables in a database. ➔ Implementation: ER diagrams guide the creation of tables, specifying primary keys, foreign keys, and other constraints based on the relationships defined in the ER diagram. Steps for creating ER models 1. Entity Identification 2. Define relationships 3. Determine attributes 4. Choose keys 5. Draw the diagram → Use standard ER diagram symbols to represent the entities, relationships, and attributes. Common Symbols: Entity → rectangle Diamond→ Ratio Attribute → Oval Primary Key → Underlined Attribute The foreign key → sometimes represented by a dashed underscore (---) or simply indicated in the attributes Types of relationships: This refers to the number of instances of an entity that can be associated with instances of another entity through a relationship. Main types of cardinality: - One to one: One person has an ID card - One-to-many: A school has many students - Many to one: many employees work in a store - From many to many: Many employees may enroll in many trainings, and many trainings may have many employees enrolled. → middle table is typically used for this. Standardization Organize and structure data efficiently to avoid redundancies and ensure data accuracy and integrity. - Eliminate data redundancy - Use primary and foreign keys - Reduction of transitive dependencies There are three normal ways: 1. First normal form → each column contains only atomic values Rule: Each cell must contain a single value (no lists or grouped data). Invalid example: Student ID Number Matters Mathematics, 1 Juan Pérez Physics 2 Maria Lopez History, Chemistry Here, under "Subjects," there are lists in a single cell. Valid example (in 1NF): Student ID Number Matter 1 Juan Pérez Mathematics 1 Juan Pérez Physics 2 Maria Lopez History 2 Maria Lopez Chemistry Now, each cell has a unique value. 2. Second normal way → to remove partial dependencies, all non-key attributes are entirely dependent on the primary key. It splits the information so that all data is completely dependent on the primary key. Invalid example: Student ID Number Matter Teacher 1 Juan Pérez Mathematics Lopez 2 Maria Lopez History Garcia Here, "Teacher" depends on "Subject", not the student. This breaks the 2NF. Valid example (in 2NF): Create multiple tables to better organize the data: 1. Estudiantes Table: | Student ID | Name | |---------------|--------------| | 1 | Juan Pérez - España | | 2 | María López - España | 2. Table of Subjects: | Subject | Teacher | |---------------|----------| | Mathematics | Lopez | | History | Garcia | 3. Student-Subject Relationship: | Student ID | Subject | |---------------|---------------| | 1 | Mathematics | | 2 | History | 3. The third normal way → to remove non-key attributes based on another non-key attribute. Non-key data should not rely on other non-key data. Invalid example: Student ID Number Matter Teacher Teacher's Office 1 Juan Pérez Mathematics Lopez Office 101 2 Maria Lopez History Garcia Office 102 Here, "Teacher Office" depends on "Teacher", not the main key. Valid example (in 3NF): We organize the data into three tables: 1. Estudiantes Table: | Student ID | Name | |---------------|--------------| | 1 | Juan Pérez - España | | 2 | María López - España | 2. Table of Subjects: | Subject | Teacher | |---------------|----------| | Mathematics | Lopez | | History | Garcia | 3. Table of Teachers: | Teacher | Professor's Office | |---------------|------------------| | Lopez | Office 101 | | Garcia | Office 102 | Database Design It is the process of defining the structure, storage, and data retrieval mechanisms in a database system. It involves creating a detailed plan for how data will be stored, accessed, and managed in a database. Schema Definition: Specifies the tables, fields, data types, and relationships in the database. Standardization: Ensures that the database structure minimizes redundancy and optimizes data integrity. Physical Deployment: Determines how the logical schema will be physically stored and accessed in the database management system. Performance optimization: Includes indexing, partitioning, and query optimization to improve database performance. Topic 3: Introduction to SQL SQL stands for Structured Query Language and is used to manage and manipulate relational databases. SQL provides commands for creating, reading, updating, and deleting data in a database. Most relational database management systems support SQL, making it universal for database interaction. Importance of SQL ➔ Data Analytics: It is essential for data analytics as it allows users to perform queries to extract meaningful insights from datasets. ➔ Big Data: It is designed to handle large volumes of data efficiently. ➔ Ease: It is easy to learn and use even without in-depth technical knowledge. Real-world applications - Business Intelligence: Companies use SQL to generate reports and analyze business performance - Finance: Banks and financial institutions use SQL for transaction processing and risk management - Healthcare: Managing medical records and patient data - E-commerce: inventory management, customer data, and sales tracking Main types of data INT → whole numbers, 42. FLOAT → floating point numbers (numbers with decimal points whose position varies depending on the value), approximate, 3.14 DOUBLE → double-precision floating point numbers, 2.739492882112 DECIMAL (p,s) → represents fixed-point numbers with defined precision (p) and scale(s). ○ Precision (p): Total number of digits (before and after the decimal point). ○ Scale(s): Number of digits after the decimal separator. ○ Example: 123.45 (DECIMAL (5,2)) VARCHAR (n) → text of variable length, up to n characters, "John Doe" (VARCHAR(100)), only uses the required amount of space, even if the maximum is higher. CHAR(n) → fixed-length text of n characters, the text always occupies the space of how many characters they set, "A" (CHAR(1)). TEXT → a lot of text, "this is a long text" DATE → DATE VALUE (YYYY-MM-DD), 2024-07-15 TIME → Time Value (HH:MM), 14:30:00 DATE TIME → Date & Time Value, 2024-07-15 14:30:00 TIMESTAMP → date and time are automatically updated, it can be updated to when a row is created or modified, or adapted to local time when accessed while stored in universal time, etc. 2024-07-15 14:30:00 BLOB → Binary Large Object, to store binary data such as images, videos, audio files, etc. in 0s and 1s. [binary data] BOOLEAN → true/false values, TRUE: Something is correct or active. FALSE: Something is incorrect or inactive. Main Structures ➔ Creating tables: Tables consist of columns and rows, where the columns define the data type and the rows contain the actual data. CREATE TABLE TableName ( Column1 Data Type 1, Column2 Data Type 2, … ); Example CREATE TABLE Students ( StudentID INT, Número Varcher (100), INT Age ); ➔ Selection of records: Retrieving data from a table. SELECT table1.column1, table2.column2,... FROM TABLE 1 JOIN TABLE2 INTO table1.common_column=table2.common_column WHERE condition; Example: two tables, one for students and one for courses SELECT Students.Name, Courses.Course OF STUDENTS JOIN Courses ON Students.StudentID = Courses.StudentID WHERE Courses.Course = 'Mathematics'; Inserting Records: Insert data into a table. INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,...) Example: INSERT IN Students (StudentID, Name, Age) VALUES (1, 'John Doe', 20); ➔ Updating Records: Updating data in a table. table_name UPDATE SET column1=value1, column2=value2,... WHERE condition; Example: UPDATE Students SET Age = 21, Name = 'Jane Doe' DONDE StudentID = 1; * *WHERE StudentID = 1: Only the row where StudentID is 1 will be updated. Without the WHERE clause, all rows would be updated. ➔ Deleting Records: Delete data from a table REMOVE FROM table_name WHERE condition; Example: REMOVE FROM Students DONDE StudentID = 1; Thanks to the condition, only a certain record will be deleted, if a condition is not included, all rows will be deleted. ➔ Modifying a table: Adding columns to a table, modifying the structure of an existing table ALTER TABLE table_name ADD column_name data type; Example: ALTER TABLE Students ADD Edad INT; ➔ Descending table: Delete a table completely, by deleting an existing table from the database DROP TABLE table_name Advanced SQL queries and data analysis 1. Inner Join An Inner Join returns only the rows that have matching values in both tables. Syntax: SELECT columns FROM TABLA1 INNER JOIN tabla2 IN tabla1.columna_común = tabla2.columna_común; 2. Left Outer Join A Left Join returns all rows from the left table (Customers) and matching rows from the right table (Orders). If there is no match, NULL is returned for the columns in the right table. Example: Syntax: SELECT columns FROM TABLE1 ON THE LEFT JOIN TABLE2 IN tabla1.columna_común = tabla2.columna_común; 3. Right Outer Join A Right Join returns all rows from the right table (Orders) and matching rows from the left table (Customers). If there is no match, NULL is returned for the columns in the left table. Example: Syntax: SELECT columns FROM TABLE1 TO THE RIGHT JOIN TABLE2 IN tabla1.columna_común = tabla2.columna_común; 4. Simple Queries for Data Analysis Definition: These queries cover basic tasks such as: Recover data. Perform aggregations. Filter results. Use simple joints. 5. Using Aggregations for Analysis Definition: They are mainly used for: Summarize data. Derive knowledge. Perform calculations on datasets. 6. Filtering Conditions Basic syntax: SELECT columna1, columna2 FROM nombre_tabla WHERE condition; Examples of filters: 1. Filter by numeric values: salario > 50000; 2. Filter by text: 3. department = 'Sales'; NOT department = 'Sales'; 4. Combine conditions: 5. department = 'Sales' AND salary > 50000; department = 'Sales' OR salary > 50000; 6. Use IN for specific values: IN department ('Sales', 'Marketing', 'HR'); 7. Filter by ranges: salary BETWEEN 40000 AND 60000; 8. Use LIKES for users: 9. primer_nombre AS 'A%'; primer_nombre AS 'A_'; 10. Filter NULL values: department IS NULL; Combination of conditions: Use operators such as AND, OR, or advanced filter combinations to refine queries as needed. Using Operators in SQL Definition SQL operators are essential tools for manipulating and retrieving data. They allow various operations to be performed on the data, such as arithmetic calculations, comparisons, logical evaluations, and the combination of multiple conditions in one query. Main types 1. Arithmetic: (+, -, *, /) 2. De comparación: (, =, , !=, LIKE) 3. Lógicos: (AND, OR, NOT) Examples 1. Arithmetic Operators: 2. SELECT carid, daily_rate, daily_rate - 5 AS discounted_rate OF cars; o Returns the car ID, your daily rate, and the rate with a discount of 5. 3. Comparison operators: SELECT * FROM CARS WHERE daily_rate > 50; oReturn all cars with a daily rate greater than 50. 4. LIKE (pattern matching) operator: SELECT * FROM cars WHERE carmodel LIKE 'Cam%'; oFind all car models starting with "Cam". 5. Logical operators: SELECT * FROM rentals WHERE NOT (return_date IS NULL); o Refund all rentals where the return date is not void. Best practices Combine operators for more complex queries. Use parentheses to avoid ambiguities in evaluations. 2. Using string functions in SQL Definition String functions in SQL are essential tools for manipulating and transforming text data. They allow operations such as concatenation, extraction, formatting, and search for specific patterns. Common Functions 1. CONCAT: 2. SELECT CONCAT(CustomerName, ' ', CustomerPhone) AS FullContact Customers; It combines the customer's name and phone number into one field. o 3. SUBSTRING: 4. SELECT SUBSTRING (customerphone, 1, 3) AS area_code OF customers; o Extract the first three characters from the customer's phone. 5. LONGITUDE: 6. SELECT LENGTH (car model) AS model_length OF cars; Returns the length of the car's model name. o 7. UPPER AND LOWER: 8. SELECT UPPER (CAR) AS uppercase_model OF cars; o Convert the model name to uppercase. 9. CLIPPING: 10. SELECT TRIM(customer_name) AS name OF customers; o Removes white spaces from the ends of the customer name. 11. REPLACE: 12. SELECT REPLACE(customer_name, 'S', 's') AS nombre OF customers; o Replace the letters "S" with "s" in the customer's name. 13. LEFT AND RIGHT: 14. SELECT RIGHT(customer_name, 2) AS last_two_chars OF customers; o Gets the last two characters of the customer's name. 3. Using Subqueries in SQL Definition Subqueries are queries within another SQL query. They are enclosed in parentheses and can be used in various clauses such as SELECT, FROM, WHERE, and HAVING. They are powerful tools for breaking down complex queries into simpler parts. Types of subqueries 1. Returning a row: o Example: o SELECT CustomerName o OF CUSTOMERS o WHERE customerid = ( o SELECT customerid o FROM rentals o ASK FOR total_cost ESCR o LIMIT 1 ); It returns the name of the customer who rented the most expensive car. ▪ 2. Returning multiple rows: o Example: o SELECT * OF the cars o WHERE CARIDA IN ( o SELECT CARID o FROM rentals o WHERE customerid IN ( o SELECT customerid o FROM rentals o GROUP BY customerid o TENER COUNT(*) > 1 o ) ); Retrieves details of cars rented by customers who have made more than ▪ two rentals. 3. In the SELECT clause: o Example: o SELECT customer_name, ( o SELECT SUM(total_amount) o FROM Orders o WHERE orders.customer_id = customers.customer_id o ) AS total_spent OF customers; ▪ Calculate the total spent by each customer. 4. In the WHERE clause: o Example: o SELECT first_name, last_name, salary o OF EMPLOYEES o WHERE the salary > ( o SELECT AVG (salary) o OF EMPLOYEES ); Return employees whose salary is higher than the average salary. ▪ 5. Correlated subqueries: o Example: o SELECT first_name, salary o OF employees e1 o WHERE the salary > ( o SELECT AVG (salary) o OF EMPLOYEES E2 o HENCE e2.department = e1.department ); ▪ Return employees whose salary is higher than average within their department. 6. With IN: o Example: o SELECT product_name o Products o WHERE product_id IN ( o SELECT product_id o FROM Orders ); ▪ Retrieves the names of products that have been ordered. Excel as a Flat Database Definition: Excel works like a flat database, storing data in a single table or sheet, without complex relational structures like SQL databases. Key points: Data storage: Each Excel sheet can represent a "table," with rows as records and columns as fields. Advantages and limitations: o Advantages: Easy data handling and simple searchability. o Limitations: Lack of referential integrity, poor scalability compared to an RDBMS. Suitable use cases: Ideal for rapid prototyping, data exploration, and small to medium-sized datasets. 2. Creating and Using Relationships in Excel Definition: Excel allows you to create relationships between tables using the Data Model, which allows you to analyze related data within the same workbook. Key points: Data Model: Built-in function that supports multiple tables with defined relationships. Relationship Settings: o Relate tables using fields that act as foreign keys (FKs). o It supports one-to-one and one-to-many relationships. Limitations: o It does not support many-to-many relationships without complex solutions (such as bridge tables). o It does not automatically apply referential integrity, requiring manual attention. 3. Data Integrity in Excel Definition: Maintaining the accuracy, consistency, and reliability of data, even without automatic constraints as in SQL. Key points: Unique identifiers: Use unique IDs to avoid duplicates and ensure consistency in data types. Validation rules: o Use the "Data Validation" feature to restrict entries (e.g., date formats or specific lists). Error control tools: o Use conditional formatting to highlight potential errors. o Use "Text in columns" to standardize formatting (e.g., dates or currencies). 4. Normalization in Excel Definition: Apply basic principles of standardization to minimize redundancies and improve data integrity. Key points: Basic Normal Forms: o 1NF: Separate atomic values into different fields. o 2NF: Separate entities into separate tabs (tables) and define primary (PK) and foreign (FK) keys. o 3NF: Remove transitive dependencies. Relational table design: Organize tables based on entities and relationships to avoid redundancies. 5. Excel Functions as SQL Equivalents Definition: Functions such as VLOOKUP, INDEX, and MATCH can simulate basic JOIN operations in SQL. Key points: VLOOKUP: Searches for data in a vertical range based on a key. o Limitations: Requires sorted data and is limited to exact matches. INDEX AND COINCIDENCE: o More flexible combination that allows left-to-right searches. Limitations: o Unlike JOINs in SQL, they are not dynamically updated when data is added or modified. 6. Creating Tables in Excel Example: Create a "CUSTOMER" table 1. Add a new sheet with the "+" button. 2. Rename the sheet to "CUSTOMER". 3. Include the fields: CustomerId, First Name, Last Name, Phone. 4. Add data. 5. Convert the table: o Select the data. o Use Insert > Table. o Make sure the first row is headers. 7. Relationships between tables 1. Create relationships by selecting the foreign keys (FK) between tables: o Relationship between Car and Brand through BrandId. o Relationship between Rental and Customer through CustomerId. o Relationship between Rental and Car through CarId. 2. Use the Data > Relationships menu. 8. Pivot Tables Definition: Advanced tool for calculating, summarizing and analyzing data, allowing you to easily identify patterns and trends. Create a PivotTable: 1. Insert a PivotTable from the Insert menu > PivotTable. 2. Configure measures, rows, columns, and filters. o Example: Analysis of days per customer (ID, first name, last name, total days). 3. Add segmentations to filter by Car Name and Car Brand. 4. Create a Pivot Chart from the PivotTable: o Insert recommended chart or customize one. Advanced Options: Segmentation: Allows you to quickly filter information. Timeline: Filter by dates for dashboards. Connecting Filters: Configure which tables are applied to each filter. Sources of economic and financial data There are numerous sources of relevant data in the economic and financial field that can be used in analyses and databases. Types of Data Analytics The aforementioned sources allow different types of analysis to be carried out, such as: 1. Descriptive AnalysisSummarizes and describes a set of data. Example: Unemployment rate for this month in Spain according to age ranges. 2. Trend analysis over timeStudy how data changes over time. Example: Evolution of unemployment in Spain over the last year, month by month. 3. Comparative analysisCompare regions, groups of people or different variables. Example: Comparison of unemployment between autonomous communities in Spain during the last year. Main sources 1. INE (National Institute of Statistics) It offers statistical data on economic, demographic and social aspects. Demography and population: Censuses, births, deaths, etc. Economy: GDP, CPI, economic surveys. Labour market: Labour force surveys. Companies and establishments: Central Directory of Companies (DIRCE), industrial surveys, innovation statistics. Society: Statistics on education, health, living conditions, geographical mobility, among others. The INE regularly updates its data and allows you to download reports, databases and interactive tools from its website. 2. Ministry of Economy, Trade and Enterprise It provides key financial data and statistics: Macroeconomics: Economic growth and other indicators. Public finances: Deficit, public debt and budget execution. Labor market: Statistics on employment, unemployment and job offers. Financial System: Evolution of the Spanish Financial System. Foreign trade: Exports, imports and trade balance. 3. Bank of Spain (BdE) Interest rate statistics. Data on the Spanish financial system. 4. Eurostat It provides high-quality statistics on Europe. Official website: Eurostat 5. World Bank Free access to global development data. Official website: World Bank Open Data 6. International Monetary Fund (IMF) It provides macroeconomic and financial data. Official website: IMF data 7. Madrid Stock Exchange Provides relevant financial data related to the stock market. 8. DataComex and DataInvex : Data on foreign trade and Spanish investments. 9. Government of Spain: Open Data Open data portal with access to multiple sources of public information. Power BI as a database tool 1. Power BI Desktop Description: Application installed on the computer, free for personal use. Main functions: o Creation of interactive reports and dashboards. o It includes PowerQuery, a tool for cleaning and transforming data from multiple sources (Excel, SQL, etc.). o It allows you to establish relationships between tables, similar to a relational database system. o Ideal for developing and designing data visualizations. Main audience: Designers and developers. 2. Power BI service Description: Cloud-based platform for sharing and collaborating on reports created with Power BI Desktop. Main functions: o Real-time data updates. o Facilitates team collaboration. o It offers fewer features than Power BI Desktop, focusing more on viewing and collaborating on reports. Primary audience: Business users who need to view and collaborate on reports. Comparison with traditional SQL databases Primary purpose: Power BI focuses on data analysis and visualization, not primary data storage. 2. Steps to build an app in 10 minutes 1. Generate data: Use AI to define the structure of a database (example: customers or rentals). 2. Create an interface: Automatically generates forms and screens based on the database. 3. Integrate logic: Add AI-powered functionalities, such as automated responses or workflows. Introduction to NoSQL Databases Definition NoSQL (Not Only SQL) databases are non-relational systems designed to store, retrieve, and manage non-tabular data. Key features 1. No fixed scheme or flexible scheme: o They allow dynamic modifications in the structure of the data. 2. Horizontal scalability: o Capable of handling large volumes of data by distributing the load among multiple servers. 3. Support for various data types: o Structured (such as tables), semi-structured (JSON), and unstructured (text, images, records, etc.). When to use them 1. When scalability is essential: o Manage large volumes of data using horizontal scaling. 2. When flexibility is needed: o Dynamic schema design allows for rapid iterations and changes. 3. When performance is key: o Optimized for specific access patterns and data models. 4. In Big Data and real-time applications: o Ideal for big data analysis and applications that require quick responses. Types of NoSQL Databases 1. Document Stores Examples: MongoDB Use: Content management systems, such as storing all the documents on a website. Case study: o A news website uses MongoDB to store articles. o Each article is a document with fields such as: ▪ Title, body, author, tags and publication date. o Advantage: The flexible structure allows you to add new fields (such as multimedia content) without the need to alter existing documents. o Scalability: Distributes the load across multiple servers to handle millions of readers.