Login

Username:

Password: 

Join us Now |  Forgot Password? | Forgot UserName?

SQL

Learn step by step



Sql syntax

SQL SELECT Statement:

SELECT column_1, column_2, column_3....column_N FROM tableName;

SQL DISTINCT Clause:

SELECT DISTINCT column_1, column_2, column_3....column_N FROM table_Name;

SQL WHERE Clause:

SELECT column_1, column_2....column_N
FROM table_name
WHERE CONDITION;

SQL AND/OR Clause:

SELECT column_1, column_2....column_N
FROM table_name
WHERE CONDITION-1 {AND|OR} CONDITION-2;

SQL IN Clause:

SELECT column_1, column_2....column_N
FROM table_name
WHERE column_name IN (val_1, val_2, val_3.....valueN);

SQL BETWEEN Clause:

SELECT column_1, column_2......column_N
FROM table_name
WHERE column_name BETWEEN val_1 AND val_2;

SQL LIKE Clause:

SELECT column_1, column_2......column_N
FROM table_name
WHERE column_name LIKE { PATTERN };

SQL ORDER BY Clause:

SELECT column1, column_2......column_N
FROM table_name
WHERE CONDITION
ORDER BY column_name {ASC|DESC};

SQL GROUP BY Clause:

SELECT SUM(column_name)
FROM table_name
WHERE CONDITION
GROUP BY column_name;

SQL COUNT Clause:

SELECT COUNT(column_name)
FROM table_name
WHERE CONDITION;

SQL HAVING Clause:

SELECT SUM(column_name)
FROM table_name
WHERE CONDITION
GROUP BY column_name
HAVING (arithmetic_function_condition);

SQL CREATE TABLE Statement:

CREATE TABLE table_name(
column_1 datatype,
column_2 datatype,
column_3 datatype,
.....
column_N datatype,
PRIMARY KEY( one or more columns )
);

SQL DROP TABLE Statement:

DROP TABLE table_name;

SQL CREATE INDEX Statement :

CREATE UNIQUE INDEX index_name
ON table_name ( column_1, column_2, column_3.....columnN);

SQL DROP INDEX Statement :

ALTER TABLE table_name
DROP INDEX index_name;

SQL DESC Statement :

DESC table_name;

SQL TRUNCATE TABLE Statement:

TRUNCATE TABLE table_name;

SQL ALTER TABLE Statement:

ALTER TABLE table_name {ADD|DROP|MODIFY} column_name {data_ype};

SQL ALTER TABLE Statement (Rename) :

ALTER TABLE table_name RENAME TO newTable_name;

SQL INSERT INTO Statement:

INSERT INTO table_name( column_1, column_2, column_3....column_N)
VALUES ( value_1, value_2, value_3....value_N);

SQL UPDATE Statement:

UPDATE table_name
SET column_1 = value_1, column_2 = value_2, column_3 = value_3....column_N=value_N
[ WHERE CONDITION ];

SQL DELETE Statement:

DELETE FROM table_name
WHERE {CONDITION};

SQL CREATE DATABASE Statement:

CREATE DATABASE database_name;

SQL DROP DATABASE Statement:

DROP DATABASE database_name;

SQL USE Statement:

USE database_name;

SQL COMMIT Statement:

COMMIT;

SQL ROLLBACK Statement:

ROLLBACK;



Related Videos