SQL Learning Hub
Master SQL concepts using real-world CFDI 4.0 data structures.
1. Tables & Structure
A Table is a collection of related data held in a structured format within a database. It consists of columns (fields) and rows (records).
Primary Key (PK)
A unique identifier for each record in a table. In our cfdi_comprobantes table, the id column is the PK.
Foreign Key (FK)
A field that links to the Primary Key of another table.
Example: emisor_id links to the cfdi_emisores table.
2. Key Concepts in this Lab
SELECT & WHERE
Use SELECT to specify columns and WHERE to filter rows. Essential for finding specific invoices (UUIDs) or dates.
JOIN
Combines rows from two or more tables. Use it to see the 'Name' of an Issuer (Emisor) instead of just their ID.
GROUP BY & Aggregates
Groups rows that have the same values into summary rows. Used with COUNT(), SUM(), AVG(). Perfect for monthly reports.
No results to display. Run a query.