TailwindSQLTailwindSQL

Like TailwindCSS, but for SQL. className your way to database queries!

React Server ComponentsSQLiteZero RuntimeType Safe
<DBclassName="db-users-name-where-id-1"/>
Jeff Lovelace

Syntax Reference

db-{table}-{column}-where-{field}-{value}-limit-{n}-orderby-{field}-{asc|desc}

Interactive Playground

Type a TailwindSQL query and see results update in real-time

<DBclassName=""as=""/>

More Examples

Different ways to query and render data with TailwindSQL

Get User Name
Fetch a single user's name by ID
<DBclassName="db-users-name-where-id-1"/>
Output
Jeff Lovelace
Product List
Display products as an unordered list
<DBclassName="db-products-title-limit-5"as="ul"/>
Output
  • Premium Monitor 1
  • Elite Webcam 2
  • Premium Microphone 3
  • Classic Hub 4
  • Modern Microphone 5
Top Posts by Likes
Posts ordered by popularity
<DBclassName="db-posts-title-orderby-likes-desc-limit-3"as="ol"/>
Output
  1. Getting Started with TypeScript
  2. Machine Learning vs Cloud Computing: Which is Better?
  3. The State of Python in 2024
Users with Posts (JOIN)
Join users with their posts
<DBclassName="db-users-name-limit-5"as="table">
<Jointable="posts"on="id-author_id"select="title"/>
</DB>
Output
Jeff Lovelace, Margaret McCarthy, Bill Gates, Ada Brin, Ken Hamilton
User Details
Select multiple columns from users table
<DBclassName="db-users-name-email-limit-5"as="table"/>
Output
nameemail
Jeff Lovelacejeff.lovelace0@example.com
Margaret McCarthymargaret.mccarthy1@example.com
Bill Gatesbill.gates2@example.com
Ada Brinada.brin3@example.com
Ken Hamiltonken.hamilton4@example.com
Top Products by Price
Sort and limit products by price
<DBclassName="db-products-title-price-orderby-price-desc-limit-3"as="table"/>
Output
titleprice
Pro Dock 322999.19
Pro Desk 712998.99
Wireless Microphone 462998.77
Published Posts
Filter published posts ordered by views
<DBclassName="db-posts-title-views-where-published-1-orderby-views-desc-limit-5"as="table"/>
Output
titleviews
The State of Python in 202459185
Getting Started with Machine Learning58944
10 Tips for Better REST APIs58911
Getting Started with Rust58346
Edge Computing vs AI: Which is Better?58127
Admin Email
Find admin user's email
<DBclassName="db-users-email-where-role-admin-limit-15"/>
Output
ken.hamilton4@example.com, sophie.wojcicki14@example.com, linus.musk22@example.com, brian.cerf25@example.com, john.thompson29@example.com, bjarne.goldwasser34@example.com, alan.huang39@example.com, alan.hopper64@example.com, john.liskov65@example.com, sheryl.perlman68@example.com, vint.torvalds69@example.com, ada.ritchie79@example.com, linus.berners-lee96@example.com, sheryl.torvalds98@example.com, guido.bartik114@example.com
Product Catalog
Full product details in a table
<DBclassName="db-products-limit-5"as="table"/>
Output
idtitledescriptionpricecategorystockratingcreated_at
1Premium Monitor 1Built for comfort and productivity251.73audio4152025-12-20 16:01:43
2Elite Webcam 2High-quality build with premium materials89.02audio2933.32025-12-20 16:01:43
3Premium Microphone 3Award-winning design and performance79.51peripherals6042025-12-20 16:01:43
4Classic Hub 4Next-generation features556.74audio4882.32025-12-20 16:01:43
5Modern Microphone 5Perfect for professionals and enthusiasts213.44audio2694.62025-12-20 16:01:43