Select Command
SELECT columnnames
FROM table_name
or
SELECT * FROM table_name
Select Command with Where Clause
SELECT select_list FROM table_list
[WHERE search_conditions]
Order by in Select Command
SELECT columnnames
FROM table_name
or
SELECT * FROM table_name
Select Command with Where Clause
SELECT select_list FROM table_list
[WHERE search_conditions]
Order by in Select Command
SELECT columns
FROM tables
WHERE yourcondition
ORDER BY column ASC/DESC;
FROM tables
WHERE yourcondition
ORDER BY column ASC/DESC;
where
ASC indicates ascending order. (default)
DESC indicates descending order.
DESC indicates descending order.
Comparison Operators
- > (greater than)
- <> not equal
- = equal
- >= greater than or equal to
- <= less than or equal to
Create Table
CREATE TABLE
[ database_name . [ schema_name ] . | schema_name . ] table_name
( column_name [ NULL | NOT NULL ] [ ,...n ] )
CREATE TABLE table_name
(
column_name1 datatype,
column_name2 datatype,
column_name3 datatype
)
Insert Command
Update Command
INSERT INTO table_name(column1, column2, column3, ...)Values(Value1,Value2,Value3,...)
INSERT INTO .. SELECT
INSERT INTO First_table(column1, column2, column3, ...)
SELECT (column1, column2, column3, ...)
from Second_table
SELECT (column1, column2, column3, ...)
from Second_table
Update Command
UPDATE
SET column_name = expression [ ,...n ]
FROM [table_source]
WHERE [search_condition]
SET column_name = expression [ ,...n ]
FROM [table_source]
WHERE [search_condition]
Delete Command
Delete from table name
Delete Command with where Condition
Delete from table name
WHERE [search_condition]
WHERE [search_condition]
No comments:
Post a Comment