-- Demo MariaDB script
-- Provided by Anthony Vogelaar, Perth Scotland
-- rev 0.10  2024-08-06  initial release

-- # mysql -u root < test_m.sql
-- $ mysql -u me -h localhost -ppwd
--   [(none)]> USE db_test;
--   [(none)]> SELECT * FROM contacts;
--   [(none)]> exit

DROP DATABASE IF EXISTS db_test;
CREATE DATABASE db_test;
USE db_test;
CREATE TABLE contacts (
    id      INTEGER     PRIMARY KEY AUTO_INCREMENT UNIQUE NOT NULL,
    name    VARCHAR(40) NOT NULL,
    job     VARCHAR(50),
    email   VARCHAR(40) NOT NULL);
INSERT INTO contacts VALUES
    (NULL, "Joe", "Senior Web Developer", "joe@example.com"),
    (NULL, "Lara", "Project Manager", "lara@example.com"),
    (NULL, "David", "Data Analyst", "david@example.com"),
    (NULL, "Jane", "Senior Python Developer", "jane@example.com");
CREATE USER 'me'@'localhost' IDENTIFIED BY 'pwd';
GRANT ALL PRIVILEGES ON *.* TO 'me'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

SELECT * FROM contacts;
