filmov
tv
SQL Lernen Module 1: Datenbank & Tabelle Erstellen, Daten Pflegen, Erste Abfrage
Показать описание
In dieses Video erstellen wir unsere erste Datenbank mit SQL. In dieser Datenbank erstellen wir eine Tabelle und füllen diese auf mit Daten.
Dieser Prozess wird mit Postgres, MySQL und Microsft Access dargestellt.
Unten steht der komplette SQL-Code des Videos
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);
Dieser Prozess wird mit Postgres, MySQL und Microsft Access dargestellt.
Unten steht der komplette SQL-Code des Videos
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);
Комментарии