# Format SQL for Raycast

URL: https://www.raycast.com/tonngw/sql-format

> Format SQL queries from your clipboard or selected text and paste them back, or preview formatted SQL, with custom formatting rules.

- Install: raycast://extensions/tonngw/sql-format
- Author: [tonngw](https://www.raycast.com/tonngw)
- Installs: 1,212
- Platforms: macOS
- Categories: Data, Developer Tools
- Updated: 2026-11-17
- Source: https://github.com/raycast/extensions/tree/c4e0f79975a011e16032382f2d1263f712f8b43c/extensions/sql-format/

## Commands

- **Format Clipboard SQL**: Formats a SQL clause string stored in clipboard and copies/pastes it back
- **Format Selected SQL**: Formats a SQL clause string selected in the foremost editor and copies/pastes it back
- **Format SQL**: Format SQL with a visual interface and copy/paste options
- **Format Selected SQL Preview**: Format selected SQL text and preview the formatted result in a new window

## README

#### Introduction

This extension is used to format SQL clause in Raycast created by [@tonngw](https://github.com/tonngw)

#### Features

- Formats a SQL clause string stored in clipboard and copies/pastes it back
- Formats a SQL clause string selected in the foremost editor and copies/pastes it back
- Preview formatted SQL with a visual interface and copy/paste options
- Format selected SQL text and preview the formatted result in a new window
- Support user defined format rules preferences, including:
  - Auto Paste: Automatically paste formatted SQL to active application
  - Tab Width: Choose between 2 spaces, 4 spaces, or tab (8 spaces)
  - Keyword Case: Preserve, Upper, or Lower case for SQL keywords

#### Commands

- **Format SQL**: Format SQL with visual interface and copy/paste options
- **Format Clipboard SQL**: Format SQL from clipboard and copy/paste back
- **Format Selected SQL**: Format selected SQL and copy/paste back
- **Format Selected SQL Preview**: Format selected SQL and preview in new window

#### Reference

- The extension refers to Format JSON extension in Raycast. It is an excellent extension for formatting JSON data in Raycast. [Format JSON](https://www.raycast.com/destiner/json-format) see more details in raycast extension store. Thanks for the original author.
- Thanks [@jfkisafk](https://github.com/jfkisafk) for the code review and suggestions for the extension.

#### License

MIT © [@tonngw](https://github.com/tonngw)
