SQL Tutorial 1: Create Database & Table, Data Input with Insert, First Query
Channel: prelearn
Date: 28/08/2016

In this video we create our first database with SQL. In this database we create a table, which we subsequently fill with data.

This process is shown with Postgres, MySQL and Microsft Access.

Below is the video's SQL code

CREATE DATABASE f1_db;

USE f1_db;

CREATE TABLE drivers
(
 driver_id smallint,
 first_name varchar(30),
 surname varchar(55),
 victories smallint,
 championships smallint
)

INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(1, 'Guiseppe', 'Farina', 5, 1);

select driver_id, first_name, surname, victories, championships from drivers;

INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(2, 'Juan-Manuel', 'Fangio', 24, 5);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(3, 'Alberto', 'Ascari', 13, 2);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(4, 'Mike', 'Hawthorne', 3, 1);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(5, 'Jack', 'Brabham', 14, 3);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(6, 'Phil', 'Hill', 3, 1);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(7, 'Graham', 'Hill', 14, 2);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(8, 'Jim', 'Clark', 25, 2);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(9, 'John', 'Surtese', 6, 1);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(10, 'Denny', 'Hulme', 8, 1);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(11, 'Jackie', 'Stewart', 27, 3);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(12, 'Jochen', 'Rindet', 6, 1);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(13, 'Emerson', 'Fittipaldi', 14, 2);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(14, 'Niki', 'Lauda', 25, 3);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(15, 'James', 'Hunt', 10, 1);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(16, 'Mario', 'Andretti', 12, 1);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(17, 'Jody', 'Schecktar', 10, 1);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(18, 'Alan', 'Jones', 12, 1);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(19, 'Nelson', 'Piquest', 23, 3);
INSERT INTO drivers (driver_id, first_name, surname, victories, championships) VALUES(20, 'Keke', 'Rosberg', 5, 1);