ame VARCHAR (50), last_name VARCHAR (100), death_date INT, description TEXT, photo INT, citienship CHAR (50) DEFAULT laquo ; Russia );
Mysql SHOW,.
: gt; SHOW databases;
book: gt; use book; gt; show tables;
Persons: gt; show columns from Persons;
DROP TABLE. ,.
: TABLE [IF EXISTS] _ [, _ ,.] [RESTRICT | CASCADE]
Mysql 3.22 IF EXISTS,,.
RESTRICT CASCADE.. gt; DROP TABLE IF EXISTS Persons, Artifacts, test;
ALTER TABLE. ,,..
: [IGNORE] TABLE _ alter_specification [, alter_specification.]
(alter_specification):
: [COLUMN] _ [FIRST | AFTER _] ADD [COLUMN] (_, _ ,.)
,, _,.
: INDEX [_] (__ ,.) ADD PRIMARY KEY (__ ,.) ADD UNIQUE [_] (__ ,.) ADD FULLTEXT [_] (__ ,.)
: [COLUMN] _ {SET DEFAULT literal | DROP DEFAULT} CHANGE [COLUMN] __ _ MODIFY [COLUMN] _
,,: [COLUMN] _ DROP PRIMARY KEY DROP INDEX _
: [TO] __.
: BY _
ALTER TABLE, DESCRIBE _,,, Mysql,. , VARCHAR CHAR Mysql VARCHAR, [22].
ALTER TABLE. ,,. ,,. ALTER TABLE.
,. , ALTER TABLE, RENAME, Mysql,,, (,).
:
Persons: gt; ALTER TABLE Persons ADD bday INTEGER AFTER last_name;
Persons.
SELECT,. , (Select_), (table_references),,, (where_definition),,,.
, SELECT, -. ,, 2 * 2, Mysql gt; SELECT 2 * 2;
SELECT: select_1, select_2,.
[FROM table_references [WHERE where_definition] [ORDER BY {| _ |} [ASC | DESC],.]]
[],, |. ORDER BY, () (- ASC, - DESC)..
select_ * raquo ;,. * select_ max, min avg.
:
Persons, first_name : gt; SELECT * FROM Persons WHERE first_name= raquo ;;
SELECT:
(title, description) 10: gt; SELECT title, description FROM Artifacts WHERE id=10;
INSERT.. _,. ,, (_) SET.
: [LOW_PRIORITY | DELAYED] [IGNORE]
[INTO] _ [(_ ,.)] VALUES (,.), (.),.
INSERT. , VALUES -.
: gt; INSERT INTO Persons (last_name, bday) VALUES ( raquo ;, тисячі дев'ятсот тридцять чотири );
Persons, (last_name) (bday) тисяча дев'ятсот тридцять чотири . [LOW_PRIORITY | DELAYED] [IGNORE]
[INTO] _ [(_ ,.)] SELECT.
INSERT,.
: gt; INSERT INTO Artifacts (author) SELECT id FROM Persons WHERE last_name= AND bday= 1 934 raquo ;;
Artifacts (author), Persons,. [LOW_PRIORITY | DELAYED] [IGNORE] [INTO] _ SET _ =, _=,.
: gt; INSERT INTO Persons SET last_name= raquo ;, first_name= raquo ;;
Persons last_name raquo ;, first_name - .
INSERT. VALUES Mysql 3.22.5. _=Mysql 3.22.10.
.
INSERT. VALUES INSERT. SELECT, VALUES () SELECT. , DESCRIBE _.
,,. ,,.
expression,. ,: Gt; INSERT INTO _ (col1, col2) VALUES (15, col1 * 2);
: gt; INSERT INTO _ (col1, col2) VALUES (col2 * 2,15);
LOW_PRIORITY DELAYED,.. LOW_PRIORITY, INSERT,. ,,. INSERT DELAYED,.
INSERT IGNORE,, PRIMARY UNIQUE,. IGNORE,,.
UPDATE.:[LOW_PRIORITY] [IGNORE] _ SET _1=1 [, _2=2 ,.] [WHERE where_definition] [LIMIT]
UPDATE. SET,. WHERE,,,.. ORDER BY,.
LOW_PRIORITY, UPDATE,.
IGNORE,,. , -,.
,,, UPDATE. , Death_date,: gt; UPDATE Persons SET death_date=death_date + 1;
Mysql 3.23 LIMIT #,,.
, title : gt; UPDATE Artifacts SET title= Limit 1;
DELETE _, where_definition,.
DELETE WHERE,.
: [LOW_PRIORITY] FROM _ [WHERE where_definition] [LIMIT rows]
, Persons, (bday) +2003: gt; DELETE FROM Persons WHERE bday gt; 2003;
: gt; DELETE FROM Persons WHERE 1 gt; 0;
,: gt; DELETE FROM Persons;
Mysql LIMIT DELETE,. , DELETE.
PHP, Mysql. Mysql...