Hosting Operations
Read-onlyFind Duplicate Emails in SQLite
You need to find duplicate email values in a SQLite users table.
Command
sqlite3 app.db "SELECT email, count(*) FROM users GROUP BY email HAVING count(*) > 1;"
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not delete duplicates from this output alone; inspect IDs and references first.
Expected output
Email values with counts greater than one.
System impact
Read-only. Nothing changes. The command groups users by email and prints repeated values.
Recovery / rollback: no state is changed.
When to use it
Use after imports, failed uniqueness migrations, or account merge bugs.
When not to use it
Do not delete duplicates from this output alone; inspect IDs and references first.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ sqlite3 app.db ".schema users"
CREATE TABLE users (
id INTEGER PRIMARY KEY,
email TEXT NOT NULL,
created_at TEXT NOT NULL
);
CREATE UNIQUE INDEX idx_users_email ON users(email);
$ sqlite3 app.db "SELECT email, count(*) FROM users GROUP BY email HAVING count(*) > 1;"
alex@example.com|2
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
sqlite3 app.db ".schema users"sqlite3 app.db "SELECT email, count(*) FROM users GROUP BY email HAVING count(*) > 1;"
next steps
Related commands
Count Rows in Key SQLite Tables
A quick row count can reveal empty imports, runaway events, or missing data.
sqlite3 app.db "SELECT 'users', count(*) FROM users UNION ALL SELECT 'orders', count(*) FROM orders UNION ALL SELECT 'events', count(*) FROM events;"
Count SQLite Events by Type
A noisy event type stands out faster when you group it.
sqlite3 app.db "SELECT event_type, count(*) FROM events GROUP BY event_type ORDER BY count(*) DESC;"
Show One SQLite Table Schema
A failed query is often just a wrong assumption about column names.
sqlite3 app.db ".schema users"
List SQLite User Tables Only
System metadata tables can distract from the app tables you care about.
sqlite3 app.db "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"
Show Recent SQLite Events
For small apps, the quickest timeline may be inside the SQLite file.
sqlite3 app.db "SELECT created_at, event_type FROM events ORDER BY created_at DESC LIMIT 5;"
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Useful for
- LPIC-1 style command-line practice
- LFCS style performance tasks
- Linux+ style troubleshooting review
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.