added tasks from 27.10.2023
This commit is contained in:
parent
03acb1a531
commit
11d76cae66
|
@ -0,0 +1,6 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
|
@ -0,0 +1,21 @@
|
||||||
|
CREATE SCHEMA task03;
|
||||||
|
USE task03;
|
||||||
|
|
||||||
|
CREATE TABLE Colors (
|
||||||
|
colorName SET ('red', 'green', 'blue')
|
||||||
|
);
|
||||||
|
|
||||||
|
/* can have multiple values at once and be empty */
|
||||||
|
INSERT INTO Colors VALUES ('red');
|
||||||
|
INSERT INTO Colors VALUES ('green');
|
||||||
|
INSERT INTO Colors VALUES ('blue,green');
|
||||||
|
INSERT INTO Colors VALUES ('');
|
||||||
|
|
||||||
|
CREATE TABLE Animals (
|
||||||
|
name ENUM ('Dog', 'Cat', 'Bird')
|
||||||
|
);
|
||||||
|
|
||||||
|
/* cannot be empty or multiple variants at once */
|
||||||
|
INSERT INTO Animals VALUES ('Dog');
|
||||||
|
INSERT INTO Animals VALUES ('Cat');
|
||||||
|
INSERT INTO Animals VALUES ('Bird');
|
|
@ -0,0 +1,21 @@
|
||||||
|
CREATE SCHEMA employees;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS employees.Employee;
|
||||||
|
|
||||||
|
CREATE TABLE employees.Employee (
|
||||||
|
id BINARY(16) PRIMARY KEY, /* automatically NOT NULL */
|
||||||
|
name NVARCHAR(64) NOT NULL, /* this field is mandatory */
|
||||||
|
email VARCHAR(32) /* optional field */
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO employees.Employee SET
|
||||||
|
id = UUID_TO_BIN(UUID()),
|
||||||
|
name = 'Hans Jürgen Peter';
|
||||||
|
|
||||||
|
INSERT INTO employees.Employee VALUES (
|
||||||
|
id = UUID_TO_BIN(UUID()),
|
||||||
|
name = 'Guten Tag',
|
||||||
|
email = 'klaus@doof.de'
|
||||||
|
);
|
||||||
|
|
||||||
|
SELECT hex(id), name, email FROM employees.Employee;
|
|
@ -0,0 +1,29 @@
|
||||||
|
CREATE SCHEMA cities;
|
||||||
|
|
||||||
|
CREATE TABLE cities.Cities (
|
||||||
|
id BINARY(16) NOT NULL, /* UUID */
|
||||||
|
name NVARCHAR(32) NOT NULL,
|
||||||
|
countryName CHAR(2) CHARACTER SET ASCII NOT NULL, /* country code such DE, US, CH, ... */
|
||||||
|
countryCode NUMERIC(3) NOT NULL, /* numeric country code */
|
||||||
|
url VARCHAR(100),
|
||||||
|
history MEDIUMTEXT,
|
||||||
|
icon BLOB
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO cities.Cities SET
|
||||||
|
id = UUID_TO_BIN(UUID()),
|
||||||
|
name = 'Berlin',
|
||||||
|
countryName = 'DE',
|
||||||
|
countryCode = 268,
|
||||||
|
url = 'https://www.berlin.de/en/',
|
||||||
|
history = 'German Empire, 3rd Reich, split into two, reunited :)';
|
||||||
|
|
||||||
|
INSERT INTO cities.Cities SET
|
||||||
|
id = UUID_TO_BIN(UUID()),
|
||||||
|
name = 'Berlin',
|
||||||
|
countryName = 'US',
|
||||||
|
countryCode = 840,
|
||||||
|
url = 'https://www.berlinnh.gov/',
|
||||||
|
history = 'some weird country. They like guns';
|
||||||
|
|
||||||
|
SELECT name, countryName, countryCode, url, history FROM cities.Cities ORDER BY countryName;
|
Loading…
Reference in New Issue