(length) [BINARY] VARCHAR (length) [BINARY]
: DATE TIME
: BLOB
: TEXT
: ENUM (value1, value2, value3,) SET (value1, value2, value3,).
_,: KEY (__,)
[_] (__,)
[_] (__,)
[INDEX] [_]
(__,)
[INDEX] [_]
(__,)
[CONSTRAINT symbol]
FOREIGN KEY [_]
(__,)
[reference_definition]
(expr)
(),,, __:
_ [(_)] KEY, CHECK REFERENCES Mysql. SQL -.
.
, (_),:
: TYPE={BDB | HEAP | ISAM | Inno DB? | MERGE | MRG_MYISAM | MYISAM}
: AUTO_INCREMENT=
: AVG_ROW_LENGTH=
(60): COMMENT=«»: MAX_ROWS=MIN_ROWS=
() CREATE - SELECT (select_).:
[IGNORE | REPLACE] SELECT
(SELECT)
CREATE SELECT,,,.
Persons: gt; CREATE TABLE Persons
(id INT PRIMARY KEY AUTO_INCREMENT, _name VARCHAR (50), last_name (100), death_date INT, TEXT, photo INT, CHAR (50) DEFAULT Russia );
Mysql SHOW,.
: gt; SHOW databases;
book:
Mysql gt; use book; gt; show tables;
Persons:
Mysql gt; show columns from Persons;
DROP TABLE. ,.
: TABLE [IF EXISTS] _
[, _,]
[RESTRICT | CASCADE]
Mysql 3.22 IF EXISTS,,.
RESTRICT CASCADE..
Mysql gt; DROP TABLE IF EXISTS Persons,
Artifacts, test;
ALTER TABLE. ,,..
:
ALTER [IGNORE] TABLE __specification
[, alter_specification]
(alter_specification):
: [COLUMN] _
[FIRST | AFTER _]
[COLUMN] (_,
_,)
,, _,.
: INDEX [_] (__,) ADDKEY (__,) ADD UNIQUE
[_] (__,) ADD FULLTEXT
[_] (__,)
: [COLUMN] _ {SET DEFAULT literal | DROP DEFAULT} [COLUMN] __ _ [COLUMN] _
,,:
DROP [COLUMN] _PRIMARY KEY INDEX _
: [TO] __.
: BY
_
ALTER TABLE, DESCRIBE _,,, Mysql,. , VARCHAR CHAR Mysql VARCHAR, [22].
ALTER TABLE. ,,. ,,. ALTER TABLE.
,. , ALTER TABLE, RENAME, Mysql,,, (,).
:
Persons:
Mysql gt; ALTER TABLE Personsbday INTEGER AFTER last_name;
Persons.
SELECT,. , (Select_), (table_references),,, (where_definition),,,.
, SELECT, -. ,, 2 * 2, gt; SELECT 2 * 2;
SELECT:
SELECT select_1, select_2,
[FROM table_references
[WHERE where_definition]
[ORDER BY {| _ |
}
[ASC | DESC],]]
[],, |. ORDER BY, () (- ASC, - DESC)..
select_ «*»,. «*» Select_ max, min avg.
:
Persons, first_name :
Mysql gt; SELECT * FROM Personsfirst_name= raquo ;;
SELECT:
(title, description) 10:
Mysql gt; SELECT title, descriptionArtifacts WHERE id=10;
INSERT.. _,. ,, (_) SET.
: [LOW_PRIORITY | DELAYED] [IGNORE]
[INTO] _ [(_,)] (,), (),
INSERT. , VALUES -.
: gt; INSERT INTO Persons
(last_name, bday) VALUES
( raquo ;, 1 934 );
Persons, (last_name) (bday) «»
«тисячі дев'ятсот тридцять чотири». [LOW_PRIORITY | DELAYED] [IGNORE]
[INTO] _ [(_,)]
INSERT,.
: gt; INSERT INTO Artifacts ...