. , . , ..
, , « » - . SQL. .
– . (). - .
– , , , . . .
– , . .
– , . . .
– . , .
SQL?
SQL (. Structured Query Language - ) . . , , sql .
1992 . , ANSI SQL. , ORACLE Microsoft SQL Server. , SQL . :
SQL
. SQL , .
| |
INT | |
REAL | |
TEXT | |
DATE | sql "" |
TIME | |
CHAR | |
, SQL :
CREATE DATABASE < >;. , .
CREATE TABLE :
Commodity :
| |
commodity_id | ID |
vendor_id | ID ( Vendors) |
commodity_name | |
commodity_price | |
commodity_desc | |
:
CREATE TABLE Commodity
(commodity_id CHAR(15) NOT NULL,
vendor_id CHAR(15) NOT NULL,
commodity_name CHAR(254) NULL,
commodity_price DECIMAL(8,2) NULL,
commodity_desc VARCHAR(1000) NULL );
. , . (NULL) (NOT NULL), .
- SQL . , . :
SELECT commodity_name FROM Commodity
SELECT , FROM .
Commodity_name , .. . ORDER BY.
, :
SELECT commodity_id, commodity_name, commodity_price FROM Commodity
. «*»:
SELECT * FROM Commodity
- SELECT :
- ( ORDER BY)
- (WHERE)
- (GROUP BY)
SQL INSERT. :
() . :
INSERT INTO Commodity VALUES('106 ', '50', 'Coca-Cola', '1.68', 'No Alcogol , )
. VALUES . , NULL. , .
, :
INSERT INTO Commodity (commodity_id, vendor_id, commodity_name)
VALUES('106 ', ‘50', 'Coca-Cola',)
, , .
INSERT , SELECT.
UPDATE. :
UPDATE :
. , ID=106 , . :
UPDATE Commodity SET commodity_price = '3.2' WHERE commodity_id = '106'
, Commodity, , SET - , WHERE ID.
SET -, . , :
UPDATE Commodity SET commodity_name=’Fanta’, commodity_price = '3.2' WHERE commodity_id = '106'
NULL, . , NULL - «» , . :
UPDATE Commodity SET commodity_desc = NULL WHERE commodity_id = '106'
SQL DELETE. :
:
DELETE FROM Commodity WHERE commodity_id = '106'
DELETE FROM , . WHERE , . ID=106. WHERE .. . .
DELETE . , .
SQL Microsoft Access
Microsoft Access , , , , SQL Access (Query Designer), SQL .
, Access SQL- ODBC . Access .
SQL
SQL , , .., SQL . .
:
- Oracle Database - PL/SQL
- Interbase, Firebird – PSQL
- Microsoft SQL Server - Transact-SQL
- PostgreSQL - PL/pgSQL.
SQL
MySQL GNU General Public License. . -, XAMPP, WAMP LAMP, .
Sun Microsystems Oracle. 64 , SQL:2003, .