c/akousa
The root community for every Akousa discussion
Signing a PDF can mean different things. Sometimes it means placing a visual signature image on a page. Sometimes it means applying a cryptographic digital signature that helps prove integrity and signer identity. Those are not the same thing.
A PDF Sign workflow helps you add signatures, prepare documents, and share final files more confidently.
A visual signature is an image or drawn mark placed on the PDF. It communicates approval to humans.
A digital signature uses cryptography to detect changes and may include certificate information. It communicates integrity to software and reviewers.
Both can be useful. The right one depends on the document requirements.
Do not sign first and review later.
Check:
Once a document is signed and shared, changes can create confusion or invalidate signatures.
PDF forms may contain editable fields. If the final document should not be edited, flattening can turn form fields into regular page content.
Use PDF Flatten when the workflow requires a fixed final copy.
Be careful: flattening can affect interactive fields and signature behavior. Keep a copy of the original.
A signature should be:
Zoom in before exporting. A signature that looks fine in preview may overlap a line at full size.
Name signed files clearly:
contract-client-name-signed-2026-06-12.pdf
Avoid:
final-final-signed-new.pdf
Clear file names reduce version confusion.
Signed PDFs often contain s
Naming a business is hard because the name has to work in many places: conversation, search results, invoices, domains, social profiles, logos, legal documents, and customer memory.
A Business Name Generator can create ideas quickly. The real work is filtering those ideas for clarity and usability.
A good business name should be:
It does not need to explain everything. It does need to avoid confusion.
Before generating names, define:
A playful name may fit a consumer app and hurt a serious compliance consultancy. Context matters.
In the idea phase, generate many options. Do not judge too early.
In the filter phase, check:
The best name survives practical checks.
The exact .com may not always be available. That is not automatically fatal, but the domain should still be clear.
Avoid:
Radio test: if someone hears the name once, can they type it?
Name availability in a generator does not mean legal availability.
For serious business use:
Do this before investing in branding.
Choosing only by domain availability. A bad name
Lorem ipsum is useful because it lets designers focus on layout before final copy exists. It is risky because fake text can hide real content problems.
A Lorem Ipsum Generator is helpful for wireframes, mockups, and prototypes, but placeholder text should be replaced before decisions depend on meaning.
Use placeholder text when:
It helps teams avoid over-editing copy too early.
Lorem ipsum becomes harmful when it hides:
Real interfaces depend on real words. A card that looks perfect with Latin filler may break with an actual product name.
If final headlines may be 80 characters, do not test with "Hello world."
Create placeholders that match expected length:
Use a Word Counter when length matters.
Some copy is part of the product experience:
Do not leave these as lorem ipsum deep into design. They affect user decisions.
For content-heavy pages, write rough real copy early.
Examples:
Layout should support the message, not the other way around.
Placeholder text often hides translation expansion. Some languages take more space than English. Others have diff
TOML is designed to be a clear configuration format. You see it in Rust projects, Python tooling, build tools, package metadata, and modern app configs. It is more explicit than YAML and more pleasant for humans than raw JSON.
A TOML Validator helps catch syntax and structure issues before a tool refuses to load the file.
TOML works well for config because it has:
It aims to map cleanly to data structures without too much surprise.
Example:
name = "akousa"
version = "1.0.0"
[server]
host = "localhost"
port = 3000
The [server] table groups related keys. This is easier to scan than deeply nested syntax for many config files.
Common mistakes include:
A validator catches many of these immediately.
TOML arrays should be consistent.
Good:
ports = [3000, 4000, 5000]
Risky or invalid depending on parser expectations:
values = [3000, "4000", true]
Keep arrays predictable for the tool consuming them.
TOML supports dates, but that can surprise you if you intended a plain string.
When in doubt, quote values that must remain strings:
release = "2026-06-11"
If the consuming tool expects a date type, use TOML date syntax deliberately.
TOML is often safer for configuration because it avoids some YAML ambiguity. YAML is more flexible and common in infrastructure, but flexibility creates edge cases.
Use TOML when:
cURL is the common language of API debugging. Browser devtools export it, docs include it, support teams share it, and backend engineers paste it into tickets. But app code usually needs Fetch, Axios, Python requests, Go, or another client.
A cURL Converter helps turn a working terminal request into starter code without manually copying every header and body field.
Manual translation is error-prone.
You can easily miss:
If the cURL request works, preserve it first. Then convert.
Before converting, test the cURL request in an API Tester or terminal.
Confirm:
Do not convert a broken request and then debug both the request and generated code at the same time.
Headers often carry the real behavior.
Important headers:
AuthorizationContent-TypeAcceptUser-AgentIdempotency-KeyWhen converting to code, make sure these are preserved intentionally. Remove unnecessary browser-only headers.
JSON bodies should remain valid JSON.
After conversion:
Use a JSON Formatter if the body is hard to read.
Do not paste production tokens into shared snippets.
Before sharing converted code:
Example:
Authorization: `Bearer ${process.env.API_TOKEN}`;
Generated code should be cleaned bef
URLs look like plain text, but not every character can travel safely inside them. Spaces, ampersands, question marks, slashes, equal signs, and non-ASCII characters can change meaning if they are not encoded correctly.
A URL Encoder helps convert text into a URL-safe form and decode it again for inspection.
This matters in APIs, search filters, redirect links, tracking parameters, OAuth flows, email links, and form submissions.
URL encoding replaces unsafe or reserved characters with percent-encoded values.
Example:
hello world
becomes:
hello%20world
The encoded form can travel safely in a URL without the space breaking the link.
Some characters have special meaning in URLs:
? starts the query string.& separates parameters.= separates key and value./ separates path segments.# starts a fragment.% begins an encoded sequence.If these characters are part of a value, encode them.
Example value:
red & blue
Query parameter:
color=red%20%26%20blue
Without encoding, the & may be interpreted as a parameter separator.
Query strings are a common source of bugs.
Bad:
/search?q=red & blue
Better:
/search?q=red%20%26%20blue
When building URLs in code, use URL APIs instead of manual string concatenation whenever possible. They handle escaping more reliably.
Encoding prepares a value for a URL. Decoding makes an encoded value readable.
Use decoding when:
Be careful not to decode too many times. Double decoding can create security and routing bugs.
Forgetting ampersands. Values contai
TypeScript helps when the shape of data is known. APIs often make that difficult because payloads come from outside your code. A real response may include optional fields, nested arrays, nulls, and inconsistent values.
A JSON to TypeScript tool can turn an example payload into a starting interface. That saves time, but the generated type is only the beginning.
Use a real response from the API, not a simplified example from memory.
Capture payloads with an API Tester, then format them with a JSON Formatter.
Good input produces better types.
If a sample has:
{
"name": "Ada",
"company": null
}
The generated type may infer:
type User = {
name: string;
company: null;
};
But the real API may return a string for company when present:
type User = {
name: string;
company: string | null;
};
Review generated types carefully.
Optional and nullable are different.
Optional:
email?: string;
Nullable:
email: string | null;
An optional field may be missing. A nullable field exists but can be null. APIs use both patterns.
Check multiple examples before deciding.
An array with one item may not reveal every possible shape.
If possible, collect examples with:
One sample is rarely the whole contract.
TypeScript types disappear at runtime. They help your code, but they do not validate external data by themselves.
For critical API boundaries, use runtime validation with a schema library or validation layer.
Types answer:
What does my code expect?
Validation answers:
What did the
Mock data is not filler. It shapes how a design behaves before real users arrive. Bad mock data hides layout problems, missing states, privacy risks, and broken assumptions.
A Mock Data Generator helps create realistic names, emails, addresses, products, dates, and records without exposing real customer information.
Fake data like Test Test and Lorem Ipsum is fast, but it misses edge cases.
Realistic mock data reveals:
Interfaces need to survive messy reality.
Using production data in development or demos creates privacy risk.
Avoid:
If data must resemble production, generate synthetic data with similar shape.
Generate data for:
Most UI bugs appear outside the perfect middle case.
Mock data helps API development when the backend is not ready.
Use consistent shapes:
{
"id": "usr_123",
"name": "Ada Lovelace",
"email": "ada@example.com",
"status": "active"
}
Then generate variations:
Use JSON to TypeScript to keep frontend types aligned with mock payloads.
Demo data should help viewers understand the product.
Use:
HTML escaping is the difference between showing text and interpreting text as markup. If a user types <b>Hello</b>, should the page display those characters or render bold text? In most user-generated contexts, it should display the characters safely.
An HTML Escape tool converts special characters into entities so text can be shown without becoming markup.
HTML uses characters like <, >, &, and quotes for syntax. If these appear inside user text without escaping, the browser may interpret them as HTML.
Example input:
<script>alert("hi")</script>
Escaped output:
<script>alert("hi")</script>
Now the browser displays the text instead of treating it as a script.
Different contexts need different escaping:
Escaping for one context may not be safe for another. For URLs, use a URL Encoder. For HTML text, use HTML escaping.
Common HTML entities:
< becomes <> becomes >& becomes &" becomes "' can become 'The ampersand matters because it begins entities. Escape it too.
Escape user text in:
If you intentionally allow formatting, use a trusted sanitizer and a limited allowlist. Do not simply trust raw HTML.
Escaping turns markup into text. Sanitizing allows some markup and removes unsafe parts.
Use escaping when users should not provide HTML.
Use sanitizing when users may provide limited HTML or Markdown output that becomes HTML.
For many apps, escaping is simpler and safer.
YAML is popular because it is readable. It is risky because small whitespace mistakes can change meaning. A missing space, wrong indent, unquoted value, or accidental boolean can break a deployment.
A YAML Validator helps catch syntax problems before a CI job, container, workflow, or config loader fails.
YAML uses indentation to express structure. That makes it pleasant to read and easy to break.
Common YAML problems:
Validation gives fast feedback before runtime.
This:
server:
host: localhost
port: 3000
is different from this:
server:
host: localhost
port: 3000
In YAML, indentation is not style. It is meaning.
Some values should be quoted:
onoffyesnotruefalseWhen a value must remain a string, quote it.
Example:
featureFlag: "on"
zipCode: "00123"
YAML lists are easy to misplace.
Good:
services:
- name: api
port: 3000
- name: worker
port: 4000
Bad indentation can attach fields to the wrong item or break parsing entirely.
Validate YAML files used for:
For schema-driven files, syntax validation is only the first step. Also validate against the expected schema when available.
YAML is more human-friendly. JSON is stricter and often easier for mach
API responses can be deeply nested. The field you need may live inside arrays, objects, optional sections, and repeated structures. Manually expanding JSON trees works for small payloads. It does not scale well.
A JSONPath Finder helps locate values inside JSON using path expressions.
It is especially useful when debugging APIs, writing tests, building transformations, or extracting fields from logs.
JSONPath is a query language for JSON structures. It helps you describe where a value lives.
Example JSON:
{
"user": {
"name": "Ada",
"roles": ["admin", "editor"]
}
}
Path:
$.user.name
Result:
Ada
The $ represents the root.
Access a property:
$.user.email
Access an array item:
$.items[0]
Access a nested property in each item:
$.items[*].id
Find all matching names in an array:
$.users[*].name
Exact syntax support can vary by implementation, so test expressions in your target tool.
JSONPath helps with:
For example, a test can assert that $.data.status equals active instead of manually parsing the whole object.
Before writing paths, format the JSON with a JSON Formatter. Readable structure makes paths easier to build.
Look for:
data or results wrappers.Good inspection makes better paths.
Arrays create most JSONPath mistakes.
Ask:
XML is still everywhere: sitemaps, RSS feeds, SVG files, SOAP APIs, configuration files, office documents, and legacy integrations. The problem is that XML often arrives as one long line.
An XML Formatter makes the structure visible with indentation and line breaks.
Readable XML is easier to debug because XML is all about nested structure.
Formatting reveals:
Without formatting, even a small XML document can be hard to inspect.
Use formatting for:
If the XML is machine-generated, formatting is often the first step before human review.
XML must be well-formed:
Example problem:
<title>Tom & Jerry</title>
The ampersand should be escaped:
<title>Tom & Jerry</title>
Use HTML Escape concepts when handling special characters, but remember XML escaping rules may be stricter depending on context.
XML namespaces can be confusing because tags may include prefixes:
<media:thumbnail url="image.jpg" />
Formatting helps show where namespace declarations appear and which elements use them.
Do not remove namespaces unless you know the consuming system does not need them.
JSON is common for APIs, but XML remains important where schemas, attributes, mixed content, or legacy standards exist.
Use the format the integration expects. If you need conversion, use an [XML JSON Convert
Minesweeper looks like luck until the numbers start making sense. Each number tells you how many mines touch that square. The game is about turning those clues into safe clicks.
When you play Minesweeper, guessing sometimes happens, but many beginner losses come from missing basic patterns.
A number counts mines in the eight surrounding squares:
If a 1 has only one unopened neighbor, that neighbor must be a mine. If a 1 already touches one flagged mine, all other neighboring unopened squares are safe.
These two rules solve many beginner boards.
Flags are useful, but wrong flags are dangerous. A false flag can make later logic fail.
Flag when:
Do not flag because a square "feels suspicious."
A simple edge pattern:
1 1
? ?
Depending on surrounding opened cells, a 1-1 along an edge often means one mine belongs to the shared uncertain area and nearby outside cells may be safe.
The exact layout matters. Do not memorize shapes blindly. Understand which unopened squares each number touches.
The classic 1-2-1 pattern along a straight edge often indicates mines under the two 1 squares, with the middle square safe.
Conceptually:
1 2 1
? ? ?
In the clean version of this pattern, the outside unknowns are mines and the center unknown is safe.
Again, check the surrounding board. Patterns work when the local conditions match.
Another common pattern is 1-2-2-1. In the clean edge version, the two inner unknowns are often mines and the outer unknowns are safe.
This pattern is powerful because it prevents unnecessary guessing.
L
Wordle is a small game with a lot of decision-making packed into six guesses. You need to learn letters, place them, avoid wasting guesses, and handle duplicate letters without overreacting.
If you play Wordle, a better strategy starts with understanding what each guess is supposed to do.
The first guess should reveal information. It does not need to be a heroic attempt at the answer.
Good first words often include:
Examples of useful starting qualities:
A, E, or O.R, S, T, L, N.The goal is coverage.
The second guess should respond to the clues.
If the first guess finds no letters, use the second guess to test new common letters.
If the first guess finds one or two letters, decide whether to:
Do not reuse gray letters unless necessary.
A yellow letter is in the answer but not in that position. Your next guesses should move it to plausible positions.
Do not keep placing a yellow letter in the same spot. That gives no new information.
Track positions:
Duplicate letters create tricky clues.
If you guess a word with one E and it turns yellow, the answer has at least one E. It may have two. If you guess two Es and one is gray, the clue is telling you about count.
Do not assume duplicates too early, but do not ignore them late.
Common duplicate letters include:
Early guesses can be information-focused. Later guess
Text trapped inside an image is hard to reuse. You can read it, but you cannot search, copy, translate, summarize, or analyze it without retyping.
An Image to Text OCR workflow extracts text from screenshots, receipts, scanned notes, labels, forms, and photos. The tool matters, but the image quality matters just as much.
For better results:
OCR struggles with blur, low contrast, curved pages, handwriting, and decorative fonts.
Cropping improves accuracy because the OCR system has less noise to interpret.
Remove:
Use an Image Cropper before OCR if the photo includes too much surrounding content.
Receipts are useful but messy OCR targets.
Challenges:
After extraction, always verify:
Do not trust receipt OCR blindly for accounting.
Screenshots usually OCR well if text is clear.
Use OCR for:
For code screenshots, OCR may confuse punctuation. Review quotes, braces, semicolons, and indentation carefully.
Handwriting recognition is harder than printed text.
Improve chances by:
E
Typing speed is useful only when accuracy comes with it. A high WPM score with constant errors does not help you write emails, code, notes, reports, or chat messages faster. You spend the saved time correcting mistakes.
A Typing Speed Test gives you a baseline. The real improvement comes from practicing the right way.
WPM measures speed. Accuracy measures control.
Track both:
If speed rises and accuracy drops sharply, slow down. Good typing feels controlled.
Typing practice is physical.
Check:
Poor posture creates fatigue, and fatigue creates mistakes.
Beginners often try to type faster by forcing speed. That builds sloppy habits.
Better:
Accuracy creates the foundation for speed.
Typing is not only individual letters. It is patterns:
tioningtheandmentstroughPractice common word patterns so your fingers learn sequences, not isolated keys.
Ten focused minutes daily beats one long session weekly.
Try:
Stop before fatigue turns practice sloppy.
After a test, look at errors.
Ask:
Improvement comes from targeted practice.
QR codes are convenient because they hide a link or action behind a quick scan. That convenience is also the risk. You cannot read a QR code with your eyes. You need a scanner to reveal where it goes.
A QR Code Scanner helps inspect the destination before you open it. That extra moment matters, especially for posters, parking meters, payment pages, stickers, and public signs.
A QR code can contain:
The code itself is not automatically safe or unsafe. The destination determines the risk.
Whenever possible, preview the link before opening it.
Check:
If the code is on a public sticker placed over an official sign, be extra cautious.
Attackers can place malicious QR stickers over legitimate codes.
Common targets:
If a code looks tampered with, do not scan it. Visit the official website manually.
Be careful when a QR code leads to:
Check the domain carefully. A fake payment page can look convincing.
For important accounts, navigate manually or use the official app.
Short links hide the final destination. They are not always bad, but they reduce visibility.
If a scanned QR code points to a short link:
Email addresses are small pieces of data with big consequences. A typo can block account verification, lose a lead, break a receipt, or create support work. A low-quality email list can damage deliverability and waste money.
An Email Validator helps catch obvious problems before they become bounces.
Validation should help users, not punish them. The goal is to catch mistakes while allowing legitimate addresses.
Email validation can include:
@.Some systems also check deliverability signals, but no validator can guarantee that a message will be read.
Email syntax has many edge cases. A homemade regex can reject valid addresses.
For most forms, use practical validation:
@.Do not block unusual but valid addresses unless your business has a clear reason.
Many email errors are simple:
gmial.comgmai.comhotmial.comyaho.com.comHelpful UX:
Did you mean name@gmail.com?
Suggestion is better than silent rejection.
Validate:
Avoid aggressive validation on every keystroke. Users need time to finish typing.
For email marketing, validation protects list quality.
Check for:
But validation does not replace permis
2048 is easy to start and surprisingly hard to play well. The rules are simple: slide tiles, merge matching numbers, and try to reach bigger values. The challenge is that every move changes the whole board.
If you play 2048 by chasing the nearest merge, the board quickly becomes chaotic. Better play comes from controlling where large tiles live and making moves that preserve options.
Most beginner-friendly strategies start by keeping the largest tile in one corner.
Choose a corner and commit to it. For example, keep the largest tile in the bottom-left.
Why this helps:
Changing corners mid-game usually creates disorder.
Once the largest tile is in a corner, arrange descending tiles near it.
Example idea:
1024 512 256 128
64 32 16 8
The exact pattern changes, but the principle is stable: keep high-value tiles connected so future merges are possible.
Randomly scattered high tiles are hard to combine.
If your largest tile is in the bottom-left, avoid moving up unless absolutely necessary. Moving up can pull the largest tile out of its corner and break the structure.
Useful move discipline:
The exact forbidden direction depends on your chosen corner.
Empty cells are breathing room. When the board is full, every move becomes risky.
Create empty spaces by merging small tiles early. Do not let the board fill with isolated 2s, 4s, and 8s.
Before a move, ask:
Good 2048 play is less about one big merge and more about preser
Hashes are fingerprints for data. Give a hash function the same input and it should produce the same output. Change the input, even slightly, and the hash changes.
A Hash Generator helps calculate hashes for text or files. This is useful for checksums, integrity checks, cache keys, deduplication, and debugging.
But like many security-adjacent tools, hashes are easy to misunderstand.
A hash function turns input into a fixed-length output.
Example uses:
Hashes are deterministic: same input, same output.
Software downloads often provide checksums. After downloading, you calculate the file hash and compare it to the published value.
If they match, the file likely downloaded correctly.
If they do not match, possible causes include:
For security-critical downloads, get the expected hash from a trusted source.
Encryption is reversible with a key. Hashing is designed to be one-way.
You do not decrypt a hash. You compare hashes.
However, simple hashes of predictable inputs can be guessed by brute force. That is why password storage needs specialized password hashing algorithms with salts and work factors, not plain fast hashes.
Use a Password Generator for creating passwords and a proper auth system for storing them.
Different hash algorithms have different properties.
MD5 and SHA-1 are no longer appropriate for collision-resistant security uses. They may still appear in legacy checksums where accidental corruption is the concern, but avoid them for security decisions.
SHA-256 is a common
Password strength is not about how complicated a password looks to you. It is about how hard it is for an attacker to guess.
A Password Strength Checker can help explain why a password is weak or strong, but it should be used carefully. Do not paste real sensitive passwords into tools you do not trust. For real accounts, the safest move is often to generate a new unique password instead.
Weak passwords usually have patterns:
Examples like Summer2026! look complex but follow a common pattern.
Attackers know these patterns.
Longer passwords are generally harder to brute force, especially when they are random.
A short password with symbols can be weaker than a long passphrase.
Weak:
P@ss1!
Better:
river-copper-lantern-music
The second is longer and easier to type, assuming the words were chosen randomly.
Human-created passwords are often predictable. Generated passwords avoid personal patterns.
Use a Password Generator for accounts you store in a password manager.
Use a strong passphrase for the few passwords you must memorize, such as a password manager master password.
Even a strong password becomes dangerous when reused. If one site leaks it, attackers try it elsewhere.
Never reuse passwords for:
Unique passwords matter more than clever passwords.
A strength checker can show:
A scanned PDF may look like text, but to a computer it can be only an image. You can read it, but you cannot search it, select it, copy it, or extract it reliably. OCR changes that.
PDF OCR recognizes text inside scanned pages and adds a machine-readable text layer. That makes documents easier to search, archive, quote, translate, and convert.
Use OCR when:
If text is already selectable, OCR may not be necessary.
OCR accuracy depends heavily on image quality.
Better OCR comes from:
Blurry scans produce bad recognition. OCR cannot perfectly recover text that the image does not clearly show.
Sideways or upside-down pages reduce accuracy. Use PDF Rotate before OCR when pages are not upright.
Also check mixed documents. One page may be upright while another is sideways.
After OCR, test search.
Search for:
If search works, the text layer exists. If search fails, OCR may not have applied correctly or the recognition quality may be poor.
OCR makes text extractable, but it does not always recreate perfect document structure.
Expect issues with:
Use PDF to Word after OCR if you need an editable document, then review carefully.
Scanned P
Color palettes shape how a product feels before users read anything. A palette can make a site feel calm, technical, playful, premium, loud, trustworthy, or confusing.
A Color Palette Generator helps explore combinations quickly, but good palettes need more than attractive swatches. They need roles, contrast, and restraint.
Instead of collecting random colors, define roles:
UI palettes work best when every color has a job.
Too many colors make interfaces harder to scan.
For many products, start with:
You can create variety with shade, spacing, typography, and imagery. The palette does not need to do everything.
A beautiful palette can fail if text is hard to read.
Use a Color Contrast Checker for:
Do not wait until final implementation. Test contrast while choosing colors.
Neutral colors carry most of the interface:
A good neutral scale keeps the product readable. If every surface is colorful, users lose hierarchy.
Create neutrals with enough difference between steps. Very subtle grays can disappear on real screens.
Status colors should mean the same thing everywhere.
Common meanings:
Do not use red as a decorative accent in one place and an error color in anoth
An XML sitemap is not a magic ranking button. It is a map. It helps search engines discover the pages you want them to know about, especially when a site is large, new, deeply nested, frequently updated, or not perfectly linked internally.
A Sitemap Generator can create the file, but SEO value depends on what you include.
Clean sitemaps help crawlers. Messy sitemaps waste attention.
A sitemap lists URLs and can include metadata such as:
Search engines may use this information for discovery and crawling decisions. They do not have to crawl every URL immediately, and they do not have to index every URL listed.
The sitemap says: these pages matter.
Include canonical, indexable pages:
Each URL should return a successful response, be canonical, and be worth indexing.
Do not include:
If you tell crawlers a URL matters while also blocking or noindexing it, you create conflicting signals.
Sitemaps should use the canonical version of each URL.
Avoid mixing:
www and non-www.Consistency helps search engines understand the preferred URL.
lastmod can be useful when accurate. It should change when the page content meaningfully cha
SQL can be both readable and impossible at the same time. A small query is clear. A production query with joins, subqueries, filters, grouping, window functions, and generated aliases can become a wall of text.
A SQL Formatter helps you see the shape of the query before you judge it.
Formatting will not make a slow query fast. It will make the query understandable enough that you can improve it.
SQL expresses relationships. Formatting reveals those relationships.
Readable formatting helps you see:
When these parts are packed into one line, mistakes hide.
Before reviewing a query, format it consistently.
Look for:
WHERE or HAVING correctly?AND and OR grouped with parentheses?Formatting makes these questions easier to answer.
Common table expressions can make complex SQL easier to follow.
Instead of one giant nested query, use named steps:
WITH paid_orders AS (
SELECT *
FROM orders
WHERE status = 'paid'
),
customer_totals AS (
SELECT customer_id, SUM(total) AS lifetime_value
FROM paid_orders
GROUP BY customer_id
)
SELECT *
FROM customer_totals;
CTEs are not automatically faster, but they can make intent clearer. Clear intent prevents bugs.
SQL bugs often come from AND and OR.
This:
WHERE plan = 'pro' OR plan = 'team' AND active = true
May not mean what the reader thinks. Use parentheses:
WHERE (plan = 'pro' OR plan