Untitled

 avatar
unknown
plain_text
2 years ago
3.6 kB
15
Indexable
-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 07, 2023 at 01:38 AM
-- Server version: 10.4.27-MariaDB
-- PHP Version: 8.1.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!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 */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `test`
--
CREATE DATABASE IF NOT EXISTS `test` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `test`;

-- --------------------------------------------------------

--
-- Table structure for table `fruits`
--

DROP TABLE IF EXISTS `fruits`;
CREATE TABLE `fruits` (
  `id` int(11) NOT NULL,
  `name` varchar(20) DEFAULT NULL,
  `unit_price` decimal(10,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `fruits`
--

INSERT INTO `fruits` (`id`, `name`, `unit_price`) VALUES
(1, 'banana', '50'),
(2, 'apple', '100'),
(3, 'orange', '120'),
(4, 'grapes', '200'),
(5, 'kiwi', '300'),
(6, 'watermelon', '150'),
(7, 'honey dew', '160');

-- --------------------------------------------------------

--
-- Table structure for table `sales`
--

DROP TABLE IF EXISTS `sales`;
CREATE TABLE `sales` (
  `id` int(11) NOT NULL,
  `quantity` varchar(2) DEFAULT NULL,
  `fruit_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `sales`
--

INSERT INTO `sales` (`id`, `quantity`, `fruit_id`) VALUES
(3, '9', 2),
(4, '9', 5),
(5, '14', 4),
(6, '4', NULL),
(7, '13', 2),
(8, '11', NULL),
(9, '11', 5),
(10, '1', 5),
(11, '10', 2),
(12, '16', 5),
(13, '2', 5),
(14, '20', 3),
(15, '11', NULL),
(16, '1', 6),
(17, '9', 4),
(18, '2', 6),
(19, '20', NULL),
(20, '8', 4),
(21, '19', 4),
(22, '14', 5),
(23, '17', 6),
(24, '20', 2),
(25, '5', 5),
(26, '5', 4),
(27, '7', 4),
(28, '9', NULL),
(29, '12', 4),
(30, '10', NULL),
(31, '16', NULL),
(32, '15', 3),
(33, '3', 4),
(34, '15', NULL),
(35, '3', 4),
(36, '13', 4),
(37, '18', 6),
(38, '10', 6),
(39, '9', NULL),
(40, '6', 2),
(41, '19', NULL),
(42, '4', 6),
(43, '2', 5),
(44, '19', 4),
(45, '7', 4),
(46, '2', NULL),
(47, '8', 4),
(48, '11', 5),
(49, '19', 3),
(50, '20', 6),
(51, '2', 3),
(52, '5', 6);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `fruits`
--
ALTER TABLE `fruits`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `sales`
--
ALTER TABLE `sales`
  ADD PRIMARY KEY (`id`),
  ADD KEY `table2_table1_id` (`fruit_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `fruits`
--
ALTER TABLE `fruits`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `sales`
--
ALTER TABLE `sales`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `sales`
--
ALTER TABLE `sales`
  ADD CONSTRAINT `table2_table1_id` FOREIGN KEY (`fruit_id`) REFERENCES `fruits` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
COMMIT;

/*!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 */;
Editor is loading...