MySQL/tasks/05-create-table.sql

22 lines
548 B
SQL

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;