CREATE DATABASE IF NOT EXISTS bookshop USE bookshop CREATE TABLE books

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
CREATE DATABASE IF NOT EXISTS bookshop; USE bookshop
CREATE TABLE books(
id MEDIUMINT PRIMARY KEY AUTO_INCREMENT, title VARCHAR (200) NOT NULL,
author VARCHAR (200) NOT NULL,
isbn VARCHAR(22),
publisher VARCHAR(40),
pages SMALLINT,
weight SMALLINT,
cover ENUM("","мягкая","твёрдая"),
pub YEAR,
electronic VARCHAR(20)
) ENGINE InnoDB;
LOAD DATA
INFILE 'C:/books.txt'
INTO TABLE books
FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n';
SELECT * FROM books;