Some of The Most Important SQL Commands: 1.select
Some of The Most Important SQL Commands: 1.select
asp
Some of The Most Important SQL Commands
SELECT - extracts data from a database
UPDATE - updates data in a database
DELETE - deletes data from a database
INSERT INTO - inserts new data into a database
CREATE DATABASE - creates a new database
ALTER DATABASE - modifies a database
CREATE TABLE - creates a new table
ALTER TABLE - modifies a table
DROP TABLE - deletes a table
CREATE INDEX - creates an index (search key)
DROP INDEX - deletes an index
1.SELECT
SELECT column_name,column_name FROM table_name;
and
SELECT * FROM table_name;
AND /OR:
The following SQL statement selects all customers from the country "Germany" AND the
city "Berlin", in the "Customers" table:
Example
SELECT * FROM Customers
WHERE Country='Germany'
AND City='Berlin';
The SQL ORDER BY Keyword
SELECT column_name,column_name
FROM table_name
ORDER BY column_name,column_name ASC|DESC;
SELECT * FROM Customers
ORDER BY Country DESC;
SELECT * FROM Customers
ORDER BY Country,CustomerName; // xp o name xp ththeo country , mi country
2. INSERT INTO
INSERT INTO table_name
VALUES (value1,value2,value3,...);
Hoc
INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...);