The Query Console gives you direct SQL access to the CodeDB database. Write queries, explore your data, and export results.
The SQL editor lets you write and run raw SQL queries against the database.
| Table | Description |
|---|---|
files | All files stored in CodeDB (id, name, path, content, language, created_at, updated_at) |
relations | Connections between files (id, source_id, target_id, relation_type, metadata) |
tags | Tags on files (id, file_id, tag) |
properties | Key-value metadata on files (id, file_id, key, value) |
smart_views | Saved Smart View queries (id, name, query, icon) |
Count files by language:
SELECT LANGUAGE, COUNT(*) AS COUNT FROM files GROUP BY LANGUAGE ORDER BY COUNT DESC;
Find all dependencies for a file:
SELECT f2.name AS depends_on, r.relation_type FROM relations r JOIN files f1 ON r.source_id = f1.id JOIN files f2 ON r.target_id = f2.id WHERE f1.name = 'app.js';
Files with specific tag:
SELECT f.name, t.tag FROM files f JOIN tags t ON f.id = t.file_id WHERE t.tag LIKE '%api%';
Most connected files:
SELECT f.name, COUNT(r.id) AS connections FROM files f LEFT JOIN relations r ON f.id = r.source_id OR f.id = r.target_id GROUP BY f.id ORDER BY connections DESC LIMIT 10;
The Query Builder provides a visual interface for constructing queries without writing SQL:
The generated SQL preview updates live as you build. Click ▶ Run to execute.
Query results can be exported in multiple formats: