Skip to content

Comprehensive Development Services to Accelerate Business Growth

From CRM solutions to web, mobile, AI, and custom software development.
SuiteCRM SQL
SuiteCRM SQL

Chapter 5: SuiteCRM SQL — MySQL & PHPMyAdmin Practice

Chapter 5 of our SuiteCRM training covers SuiteCRM SQL — understand how to query, join, and update CRM safely through PHPMyAdmin, with golden rules that every developer needs to follow.

Editorial Team

All things you have learned in the previous four days, including the hooks, the modules, the relationships, the utility functions, everything lives in a database. Chapter 5 of our SuiteCRM training reveals how SuiteCRM stores its data and provides you with the skills to inspect, query, and directly update it.


By Chapter 5, your configuration part is done, and now the real work starts. You will learn how the database of SuiteCRM is structured, why soft deletes are important, how custom fields are separately stored and joined back in, and the golden rules you can use to keep your queries safe. Irrespective of whether you are debugging a logic, auditing records, or developing a report that the UI simply cannot recreate, being familiar with your database makes everything else clearer and faster.


SuiteCRM Database Architecture


Modules → Tables: Every module maps to one or more database tables (e.g., Accounts → accounts table).

Soft Delete: Records are never physically removed; a deleted = 1 flag is set. ALL queries must include WHERE deleted = 0.

UUID Primary Keys: All records use a UUID-style ID field (CHAR 36), not auto-increment integers.

M: M Tables: Stored in relationship tables named module1_module2 (e.g., accounts_contacts).

Custom Fields: Stored in _cstm tables (e.g., accounts_cstm), joined on id = id_c.


Learn More: Chapter 4 – Outright Utils & Flight: Smarter SuiteCRM Development


Core SQL Syntax

Related walkthrough

SuiteCRM Training Day 5 | SQL Queries and Database Management in SuiteCRM

Practical guidance from the Outright Systems team. Watch on YouTube

SELECT — Reading Data



JOIN — Combining Tables



Aggregate Functions




UPDATE — Modifying Records



HARD RULE: Always include a WHERE clause in UPDATE statements. An UPDATE without WHERE modifies every single row in the table. In SuiteCRM, always soft-delete (deleted = 1) — never use physical DELETE on CRM tables.


Subqueries



SuiteCRM SQL Golden Rules


  1. Always WHERE deleted = 0 — SuiteCRM never physically deletes rows.
  2. Never hard-code integer IDs — all CRM IDs are UUIDs (CHAR 36).
  3. Custom fields live in _cstm tables — JOIN them on id = id_c.
  4. Test every UPDATE/DELETE in staging first.
  5. Never run UPDATE or DELETE without a WHERE clause.

Conclusion


SuiteCRM SQL is one of the main skills that improves everything else you do quietly. Once you have a clear understanding of how the data is being laid out, which tables hold which data, how custom fields join back to their parent records, and why the deleted = 0 exists in each of the single queries, you will no longer rely on guesswork and be more aware of every query. The blog also offers you golden rules covered at last that are not only the best practice, but the core difference between a safe query and one that changes each row in a table. In Chapter 6 of our SuiteCRM training, we will take things outside of the database and go into the API layer.


You will learn how SuiteCRM verifies external requests through OAuth 2.0, how to interact with REST API v8 endpoints, and how to use Google OAuth for integrations, providing your CRM the capability to send, receive, and sync with data stored in external tools.

Article rating

Was this article useful?

5.0 out of 5 from 2 ratings

Discover our most-read articles, packed with expert insights, practical tips, and industry-leading knowledge.

Need Answers Before You Get Started?

Clear answers about custom CRM, integrations, automation, and support.

  1. We offer Custom CRM Development, CRM Consulting, and CRM Development Services, including SuiteCRM Development, SugarCRM Development, and CRM Customization Services.

Let's stay in touch!

We'll send you a newsletter once per week. No spam.