DEV Community

Cover image for SQL Review - Useful queries for mySQL
Jo
Jo

Posted on

3 1

SQL Review - Useful queries for mySQL

This post will cover some useful mySQL queries that I am just now discovering and that would have been really helpful when I just started my journey of learning sql. Alas, we live and we learn.

Show databases

The

show databases;

command shows you a list of the databases available.

Use database_name

The

use database;

command allows you to switch between databases. I've found this one pretty helpful, pretty helpful I'd been double, triple, and quadrouple clicking a database name in mySQL in order to navigate among databases.

Show table

The

show table

command shows you the tables in a database (which could be especially useful after the use database command)

Desc table_name

The

DESC table_name;

command shows field, type, key, null value, and default values of a table. This is very helpful for troubleshooting.The extra column would hold something like "auto _increment" for a primary key.

Show Warnings

The

SHOW warnings

command shows what the warning message is if your query is not correct in some way.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay