DEV Community

Cover image for Sql basic command
Sachin
Sachin

Posted on

Sql basic command

I explain the sql basic command
go to shell
SHOW DATABASES;
it show all the databases

USE

To select the any databased

SHOW TABLES

to show all the table

CREATE DATABSED

to create a databased name

CREATE TABLE {

<col_name>[data type]<keyword>,
<col_name>[data type]<keyword>,
<col_name>[data type]<keyword>
Enter fullscreen mode Exit fullscreen mode

};
To create a table and add col in the table

DESC

to show the structure and description on the table

INSERT INTO

(col1,col2,col3...)VALUES(,value2>,);

SELECT FROM

if use * it select all the column

SELECT * FROM

WHERE {Condition}

condition will be comaparison = <,> ==, LIKE ,%,%_%

SELECT * FROM

WHERE {Condition} ORDER BY {colname} LIMIT {no}

if you write the order by ascending order
if you write ORDER BY DESC -descending order


Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

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

Okay