Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

sqlcheck

> 数据库
Open source

Automatically identify anti-patterns in SQL queries

2.5K stars0 likes1 views
WebsiteGitHub

About

Automatically identify anti-patterns in SQL queries

What Is SQLCheck?

sqlcheck automatically detects common SQL anti-patterns. Such anti-patterns often slow down queries. Addressing them will, therefore, help accelerate queries.

sqlcheck targets all major SQL dialects.

For development updates on sqlcheck and general news on next generation database systems, follow me at @joy_arulraj.

What it can do

Right now SQLCheck can detect the following anti-patterns:

Logical Database Design Anti-Patterns

  • Multi-Valued Attribute
  • Recursive Dependency
  • Primary Key Does Not Exist
  • Generic Primary Key
  • Foreign Key Does Not Exist
  • Entity-Attribute-Value Pattern
  • Metadata Tribbles

Physical Database Design Anti-Patterns

  • Imprecise Data Type
  • Values In Definition
  • Files Are Not SQL Data Types
  • Too Many Indexes
  • Index Attribute Order

Query Anti-Patterns

  • SELECT *
  • NULL Usage
  • NOT NULL Usage
  • String Concatenation
  • GROUP BY Usage
  • ORDER BY RAND Usage
  • Pattern Matching Usage
  • Spaghetti Query Alert
  • Reduce Number of JOINs
  • Eliminate Unnecessary DISTINCT Conditions
  • Implicit Column Usage
  • HAVING Clause Usage
  • Nested sub queries
  • OR Usage
  • UNION Usage
  • DISTINCT & JOIN Usage

Application Development Anti-Patterns

  • Readable Passwords

Installation

###UBUNTU/MINT (DEBIAN)

  1. Download the debian package from the latest release.
bash
wget https://github.com/jarulraj/sqlcheck/releases/download/v1.3/sqlcheck-x86_64.deb
  1. Install it by running the following command.
bash
dpkg -i sqlcheck-x86_64.deb

FEDORA/CENTOS (RPM)

  1. Download the rpm package from the latest release.
bash
wget https://github.com/jarulraj/sqlcheck/releases/download/v1.3/sqlcheck-x86_64.rpm
  1. Install it by running the following command.
bash
yum --nogpgcheck localinstall sqlcheck-x86_64.rpm 

MAC (DMG)

  1. Download the dmg package from the latest release.
bash
wget https://github.com/jarulraj/sqlcheck/releases/download/v1.3/sqlcheck-x86_64.dmg
  1. Click the dmg to mount the package. This will mount it in the Volumes directory.

  2. Open the Terminal app. This page contains more details on finding the app.

  3. Copy over the SQLCheck binary file to desired local directory.

bash
cp /Volumes/sqlcheck-x86_64/bin/sqlcheck /usr/local/bin/

WINDOWS (EXE)

  1. Download the exe file from the latest release.
bash
wget https://github.com/jarulraj/sqlcheck/releases/download/v1.3/sqlcheck.exe
  1. Open a terminal (like cmd.exe) and run the executable.

ZIP

  1. Download the zip package from the latest release.
bash
wget https://github.com/jarulraj/sqlcheck/releases/download/v1.3/sqlcheck-x86_64.zip
  1. Unzip it and find the SQLCheck binary (bin/sqlcheck).
bash
unzip sqlcheck-x86_64.zip

SOURCE CODE

SQLCheck has the following software dependencies:

  • g++ 4.9+
  • cmake (Cmake installation guide)

First, clone the repository (with --recursive option).

bash
git clone --recursive https://github.com/jarulraj/sqlcheck.git

Next, run the following commands to build and install SQLCheck:

bash
./bootstrap
cd build
cmake -DCMAKE_BUILD_TYPE=RELEASE ..
make
make install

TESTS

To run SQLCheck unit tests during development, run:

bash
./build/test/test_suite

Usage

$ sqlcheck -h

Command line options : sqlcheck <options>
   -f --file_name          :  file name
   -r --risk_level         :  set of anti-patterns to check
                           :  1 (all anti-patterns, default) 
                           :  2 (only medium and high risk anti-patterns) 
                           :  3 (only high risk anti-patterns) 
   -c --color_mode         :  color mode 
   -v --verbose_mode       :  verbose mode
…
…

References

(1) SQL Anti-patterns: Avoiding the Pitfalls of Database Programming, Bill Karwin
(2) Common SQL Anti-patterns, StackOverflow

Contributions

Contributions to SQLCheck are always welcome. You can contribute in different ways:

  • Open an issue with suggestions for improvements and errors you're facing;
  • Fork this repository and submit a pull request;
  • Improve the documentation.

License

Licensed under the Apache License.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++command-linedatabasemicrosoft-sql-servermysql

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库