30 lines
904 B
SQL
30 lines
904 B
SQL
CREATE DATABASE if not exists titanic;
|
|
USE titanic;
|
|
|
|
CREATE TABLE passengers (
|
|
id INT PRIMARY KEY,
|
|
pclass INT NULL,
|
|
survived BOOLEAN NULL,
|
|
first_name VARCHAR(255) NULL,
|
|
salutation VARCHAR(255) NULL,
|
|
last_name VARCHAR(255) NULL,
|
|
sex VARCHAR(10) NULL,
|
|
age FLOAT NULL,
|
|
sibsp INT NULL,
|
|
parch INT NULL,
|
|
ticket VARCHAR(30) NULL,
|
|
fare DECIMAL(10,4) NULL,
|
|
cabin VARCHAR(30) NULL,
|
|
embarked CHAR(1) NULL,
|
|
boat VARCHAR(10) NULL,
|
|
body VARCHAR(5) NULL,
|
|
city1 VARCHAR(255) NULL,
|
|
state1 VARCHAR(255) NULL,
|
|
city2 VARCHAR(255) NULL,
|
|
state2 VARCHAR(255) NULL
|
|
);
|
|
|
|
LOAD DATA INFILE '/var/lib/mysql-files/passengers.csv'
|
|
INTO TABLE passengers
|
|
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
|
|
LINES TERMINATED BY '\n' (id,pclass,survived,first_name,salutation,last_name,sex,age,sibsp,parch,ticket,fare,cabin,embarked,boat,body,city1,state1,city2,state2); |