#2 Programando un sistema de ventas real | Diseño de la base de datos
Introduction to the Course on Real Sales System Development
Overview of the Project
- Héctor de León introduces himself and outlines the purpose of the video series, which focuses on developing a real sales system.
- The project will involve creating a system that can generate sales, store them in a database, and utilize SQL Server as part of its requirements.
Technologies Involved
- The application will be built using Angular for the frontend and Chamartín for backend services, with an intermediary service to centralize methods.
- A third-party SMTP server will be used for email functionalities within the application.
Database Design Process
Importance of Database
- The database is essential for storing information that can be retrieved later for reporting and consultation purposes.
- SQL Server will be utilized; users must specify service name, username, and password to connect.
Creating a Database
- Héctor demonstrates how to create a new database named "venta real" using Microsoft SQL Server Management Studio (SSMS).
- He emphasizes downloading free versions of SQL Server for practice.
Structuring Tables in the Database
Initial Table Creation
- Discussion on creating tables necessary for storing sales data; specifically focusing on 'venta' (sales).
- Two primary tables are identified: one for sales ('venta') and another for sale items or products ('conceptos') linked to each sale.
Key Considerations in Table Design
- Importance of choosing appropriate data types such as bigint versus int based on expected data volume.
- Recommendations include using primary keys effectively while considering future scalability when dealing with large datasets.
Defining Sale Attributes
Essential Fields in Sales Table
- Key fields discussed include date/time of sale and total amount. Storing total amounts is considered good practice despite being calculable from individual item totals.
- Total field type is set as decimal with specific character limits to ensure accuracy in financial reporting.
Creating Product Concept Table
Structure of Product Table
- A new table called 'concepto' or product is created with fields like quantity, unit price, and total amount per product sold.
- Emphasis placed on performance considerations when generating reports from large datasets by pre-calculating totals rather than recalculating during queries.
Linking Products to Sales
Establishing Relationships Between Tables
- Discussion about linking product details directly into sales transactions through foreign keys ensuring relational integrity between tables.
Visualizing Database Structure
Using Diagrams for Clarity
- Héctor shows how to create visual diagrams within SSMS to represent relationships between different tables clearly.
(t=955] Adding Customer Information
Incorporating Customer Data
- A new table named 'cliente' (customer ) is introduced , allowing tracking of customer information related to each sale .
Conclusion
Next Steps
- Héctor concludes by stating that further videos will build upon this foundational work , adding more components and features over time .