db lab 6
This commit is contained in:
@@ -0,0 +1,172 @@
|
||||
CREATE DATABASE IF NOT EXISTS `paintingbusiness` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */;
|
||||
USE `paintingbusiness`;
|
||||
-- MySQL dump 10.13 Distrib 8.0.45, for Win64 (x86_64)
|
||||
--
|
||||
-- Host: 127.0.0.1 Database: paintingbusiness
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.5.5-10.4.32-MariaDB
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!50503 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `contracts`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `contracts`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `contracts` (
|
||||
`contract_id` int(11) NOT NULL,
|
||||
`customer_id` int(11) NOT NULL,
|
||||
`employee_id` int(11) NOT NULL,
|
||||
`address` varchar(255) NOT NULL,
|
||||
`scheduled_for` datetime NOT NULL,
|
||||
PRIMARY KEY (`contract_id`),
|
||||
KEY `customer_id` (`customer_id`),
|
||||
KEY `employee_id` (`employee_id`),
|
||||
CONSTRAINT `contracts_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`customer_id`),
|
||||
CONSTRAINT `contracts_ibfk_2` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `contracts`
|
||||
--
|
||||
|
||||
LOCK TABLES `contracts` WRITE;
|
||||
/*!40000 ALTER TABLE `contracts` DISABLE KEYS */;
|
||||
INSERT INTO `contracts` VALUES (1,1,2,'123 Maple St','2026-04-10 10:00:00'),(2,2,1,'45 Oak Ave','2026-04-12 09:00:00'),(3,3,3,'78 Pine Rd','2026-04-15 13:30:00');
|
||||
/*!40000 ALTER TABLE `contracts` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `customers`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `customers`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `customers` (
|
||||
`customer_id` int(11) NOT NULL,
|
||||
`first_name` varchar(25) NOT NULL,
|
||||
`last_name` varchar(30) NOT NULL,
|
||||
`address` varchar(255) NOT NULL,
|
||||
`phone` varchar(15) NOT NULL,
|
||||
`email` varchar(30) NOT NULL,
|
||||
PRIMARY KEY (`customer_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `customers`
|
||||
--
|
||||
|
||||
LOCK TABLES `customers` WRITE;
|
||||
/*!40000 ALTER TABLE `customers` DISABLE KEYS */;
|
||||
INSERT INTO `customers` VALUES (1,'John','Smith','123 Maple St','416-555-1111','john.smith@email.com'),(2,'Sarah','Johnson','45 Oak Ave','416-555-2222','sarah.j@email.com'),(3,'Michael','Brown','78 Pine Rd','416-555-3333','m.brown@email.com');
|
||||
/*!40000 ALTER TABLE `customers` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `employees`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `employees`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `employees` (
|
||||
`employee_id` int(11) NOT NULL,
|
||||
`first_name` varchar(25) NOT NULL,
|
||||
`last_name` varchar(30) NOT NULL,
|
||||
`address` varchar(255) NOT NULL,
|
||||
`hire_date` datetime NOT NULL,
|
||||
`salary` int(11) NOT NULL,
|
||||
PRIMARY KEY (`employee_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `employees`
|
||||
--
|
||||
|
||||
LOCK TABLES `employees` WRITE;
|
||||
/*!40000 ALTER TABLE `employees` DISABLE KEYS */;
|
||||
INSERT INTO `employees` VALUES (1,'David','Wilson','22 Birch Ln','2022-04-12 09:00:00',45000),(2,'Emily','Davis','91 Cedar Dr','2023-01-20 09:00:00',42000),(3,'Robert','Taylor','15 Spruce Ct','2021-07-15 09:00:00',48000);
|
||||
/*!40000 ALTER TABLE `employees` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `inventory`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `inventory`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `inventory` (
|
||||
`paint_id` int(11) NOT NULL,
|
||||
`paint_name` varchar(30) NOT NULL,
|
||||
`cost_per_can` decimal(2,0) NOT NULL,
|
||||
`quantity` int(11) NOT NULL,
|
||||
PRIMARY KEY (`paint_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `inventory`
|
||||
--
|
||||
|
||||
LOCK TABLES `inventory` WRITE;
|
||||
/*!40000 ALTER TABLE `inventory` DISABLE KEYS */;
|
||||
INSERT INTO `inventory` VALUES (1,'Arctic White',30,50),(2,'Ocean Blue',35,40),(3,'Sunset Yellow',28,60);
|
||||
/*!40000 ALTER TABLE `inventory` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `rooms`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `rooms`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `rooms` (
|
||||
`room_id` int(11) NOT NULL,
|
||||
`contract_id` int(11) NOT NULL,
|
||||
`paint_id` int(11) NOT NULL,
|
||||
`room_name` varchar(30) NOT NULL,
|
||||
PRIMARY KEY (`room_id`),
|
||||
KEY `contract_id` (`contract_id`),
|
||||
KEY `paint_id` (`paint_id`),
|
||||
CONSTRAINT `rooms_ibfk_1` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`contract_id`),
|
||||
CONSTRAINT `rooms_ibfk_2` FOREIGN KEY (`paint_id`) REFERENCES `inventory` (`paint_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `rooms`
|
||||
--
|
||||
|
||||
LOCK TABLES `rooms` WRITE;
|
||||
/*!40000 ALTER TABLE `rooms` DISABLE KEYS */;
|
||||
INSERT INTO `rooms` VALUES (1,1,1,'Living Room'),(2,2,2,'Bedroom'),(3,3,3,'Kitchen');
|
||||
/*!40000 ALTER TABLE `rooms` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2026-03-14 20:50:41
|
||||
Reference in New Issue
Block a user