Attributes
Attributes in hotel_db
This lesson explains the concept in the hotel_db database you build throughout the BrainTech SQL/MySQL course. Tables gosti, sobe, rezervacije, placanja, and zaposleni are not abstract — they model check-in, billing, daily revenue reports, and front-desk operations in a real hotel information system.
Hotel reception and finance depend daily on correct use of „Attributes“. Misuse causes mismatched data between gosti, rezervacije, and placanja — a guest sees a confirmed booking while finance sees no payment. Test every change on a hotel_db copy before production. In hotel_db reception, finance, and housekeeping share gosti, sobe, rezervacije, placanja, and zaposleni — every change must stay consistent for all app modules.
In depth
Practice „Attributes“ on hotel_db test data: insert guests, reservations, and payments, run the query, and compare with expectations. Document steps in a .sql file and check EXPLAIN when rezervacije exceeds tens of thousands of rows — indexes become critical. In Workbench run the sample SQL on test data before production, check EXPLAIN as tables grow, and document expected results for teammates.
Key points
- Examples from hotel_db: gosti, sobe, rezervacije, placanja. — hotel_db example.
- Test SQL in Workbench before production. — hotel_db example.
- Combine with JOINs and indexes. — hotel_db example.
- Document expected results. — hotel_db example.
- Connect theory to hotel business flow. — hotel_db example.
Common mistake
Most common mistake: changing hotel_db schema or bulk-updating data without understanding „Attributes“, without WHERE, and without a mysqldump backup. One wrong UPDATE on rezervacije can cancel hundreds of stays at once. Typical fallout: mismatched reception vs finance data, lost reservations, or blocked check-ins at peak season — always backup before production DDL/DML.
Summary
Master „Attributes“ through hotel_db until you can write the queries or DDL reception and finance use every morning — then you are ready for exercises, JOIN tasks, and the final hotel project. Practice again on hotel_db until you can explain every result row and tie it to hotel workflows (check-in, billing, reporting).
Note: Tip: keep versioned .sql scripts (hotel_schema.sql, seed.sql) in Git — reproducibility matters when several people work on the same hotel_db model.
