TRENDING TOPICS

×

What are the basic commands in SQL?

By: Jaya Aby | 09 June 2019

R

RENUKA KHANNA

03 March 2020

CREATE A TABLE COMMAND IN SQL

CREATE TABLE table_name (

  column_1 datatype,

  column_2 datatype,

  column_3 datatype );

ALTER A TABLE COMMAND IN SQL

ALTER TABLE table_name

ADD column_name datatype;

DELETE A TABLE COMMAND IN SQL

DELETE FROM table_name

WHERE some_column = some_value;

INSERT RECORD IN SQL TABLE COMMAND

INSERT INTO table_name (column_1, column_2, column_3)

VALUES (value_1, 'value_2', value_3);

USE GROUP BY CLAUSE COMMAND IN SQL

SELECT column_name, COUNT(*)

FROM table_name

GROUP BY column_name;

HOW TO USE HAVINF COMMAND IN SQL

SELECT column_name, COUNT(*)

FROM table_name

GROUP BY column_name

HAVING COUNT(*) > value;

JOINING COMMAND IN SQL

SELECT column_name(s)

FROM table_1 JOIN table_2

ON table_1.column_name = table_2.column_name;

AND OPERATOR COMMAND

SELECT column_name(s)

FROM table_name

WHERE column_1 = value_1 AND column_2 = value_2;


AS [ALIAS] COMMAND

SELECT column_name AS 'Alias'

FROM table_name;

AVG() | COUNT() FUNCTION OPERATOR COMMAND IN SQL DATABASE

SELECT AVG(column_name)

FROM table_name;

SELECT COUNT(column_name)

FROM table_name;

BETWEEN COMMAND WITH WHERE CONDITION

SELECT column_name(s)

FROM table_name

WHERE column_name BETWEEN value_1 AND value_2;

CASE COMMAND IN SQL TABLE

SELECT column_name,

  CASE

    WHEN condition THAN 'Result_1'

    WHEN condition THAN 'Result_2'

    ELSE 'Result_3'

  END FROM table_name;

1 votes

Your Answer

Advertise With Us

We offer sponsored posts and guest posts with do-follow links, back-links, and other advertising services, To advertise email us at "advertise@gdatamart.com"

© 2021 GDATAMART.COM (All Rights Reserved)