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


Top comments (0)