
CREATE TABLE suppliers (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(150) NOT NULL,
email VARCHAR(150),
phone VARCHAR(50),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB;


CREATE TABLE products (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(150) NOT NULL,
category ENUM('ovoce','zelenina') NOT NULL,
price DECIMAL(10,2) NOT NULL DEFAULT 0.00,
stock INT NOT NULL DEFAULT 0,
supplier_id INT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (supplier_id) REFERENCES suppliers(id) ON DELETE SET NULL
) ENGINE=InnoDB;


-- Ukázková data
INSERT INTO suppliers (name, email, phone) VALUES
('Zahradnictví Novák','novak@example.com','+420601123456'),
('Bio Farma','info@biofarma.cz','+420602987654');


INSERT INTO products (name, category, price, stock, supplier_id) VALUES
('Jablko Golden','ovoce',25.50,100,1),
('Mrkev','zelenina',12.00,50,2);

INSERT INTO suppliers (name, email, phone) VALUES
                                               ('Fresh Farm', 'info@freshfarm.cz', '+420601111111'),
                                               ('Green World', 'contact@greenworld.cz', '+420602222222'),
                                               ('Bio Harvest', 'sales@bioharvest.cz', '+420603333333'),
                                               ('Veggie Source', 'office@veggiesource.cz', '+420604444444'),
                                               ('Local Growers', NULL, '+420605555555');
INSERT INTO customers (name, email, phone, address) VALUES
                                                        ('Jan Novák', 'jan.novak@email.cz', '+420700111111', 'Praha 1, Hlavní 12'),
                                                        ('Petra Svobodová', 'petra.s@email.cz', '+420700222222', 'Brno, Květná 5'),
                                                        ('Martin Dvořák', NULL, '+420700333333', 'Ostrava, Lesní 88'),
                                                        ('Firma ABC s.r.o.', 'info@firmaabc.cz', NULL, NULL),
                                                        ('Lucie Malá', 'lucie.m@email.cz', '+420700555555', 'Plzeň, Polní 3');
