Duombaze.sql Direct

-- 1. Create the database (duombaze) CREATE DATABASE IF NOT EXISTS imones_duombaze CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; USE imones_duombaze; Use code with caution. Copied to clipboard 2. Table Definitions

-- Insert sample categories INSERT INTO kategorijos (pavadinimas, aprasymas) VALUES ('Elektronika', 'Kompiuteriai, telefonai ir kiti įrenginiai'), ('Biuro reikmenys', 'Popierius, rašikliai ir kita'); -- Insert sample products INSERT INTO prekes (kategorija_id, pavadinimas, kaina, kiekis) VALUES (1, 'Nešiojamas kompiuteris Pro', 1200.50, 5), (1, 'Išmanusis telefonas X', 850.00, 10), (2, 'A4 formato popierius (500 lapų)', 5.99, 100); Use code with caution. Copied to clipboard 4. Basic Query Examples Duombaze.sql

Define your tables with primary keys, foreign keys, and constraints to ensure data integrity. Common tools like dbForge SQL Complete can help with advanced formatting and autocompletion of these T-SQL codes. Table Definitions -- Insert sample categories INSERT INTO

-- Select all products with their category names SELECT p.pavadinimas AS Preke, p.kaina, k.pavadinimas AS Kategorija FROM prekes p LEFT JOIN kategorijos k ON p.kategorija_id = k.id; -- Find products with low stock (less than 10) SELECT * FROM prekes WHERE kiekis < 10; Use code with caution. Copied to clipboard Best Practices for Your SQL Draft Common tools like dbForge SQL Complete can help

: If building a CMS, you might implement a "draft" system by adding an IsFinal or Status column to your tables to distinguish between published and unpublished entries.