Use a sub query to find customers (first and last names) who did not purchase anything on July 10, 2021. Below are the Data/ Information -- Table structure for table `customer` CREATE TABLE `customer` ( `customer_numb` int(11) NOT NULL, `first_name` varchar(30) DEFAULT NULL, `last_name` varchar(30) DEFAULT NULL, `street` varchar(50) DEFAULT NULL, `city` varchar(30) DEFAULT NULL, `state_province` char(2) DEFAULT NULL, `zip_postcode` char(10) DEFAULT NULL, `contact_phone` char(12) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `customer` -- INSERT INTO `customer` (`customer_numb`, `first_name`, `last_name`, `street`, `city`, `state_province`, `zip_postcode`, `contact_phone`) VALUES (1, 'Janice', 'Jones', '125 Center Road', 'Anytown', 'NY', '11111', '518-555-1111'), (2, 'Jon', 'Jones', '25 Elm Road', 'Next Town', 'NJ', '18888', '209-555-2222'), (3, 'John', 'Doe', '821 Elm Street', 'Next Town', 'NJ', '18888', '209-555-3333'), (4, 'Jane', 'Doe', '852 Main Street', 'Anytown', 'NY', '11111', '518-555-4444'), (5, 'Jane', 'Smith', '1919 Main Street', 'New Village', 'NY', '13333', '518-555-5555'), (6, 'Janice', 'Smith', '800 Center Road', 'Anytown', 'NY', '11111', '518-555-6666'), (7, 'Helen', 'Brown', '25 Front Street', 'Anytown', 'NY', '11111', '518-555-7777'), (8, 'Helen', 'Jerry', '16 Main Street', 'Newtown', 'NJ', '18886', '209-555-8888'), (9, 'Mary', 'Collins', '301 Pine Road, Apt. 12', 'Newtown', 'NJ', '18886', '209-555-9999'), (10, 'Peter', 'Collins', '18 Main Street', 'Newtown', 'NJ', '18886', '209-555-1010'), (11, 'Edna', 'Hayes', '209 Circle Road', 'Anytown', 'NY', '11111', '518-555-1110'), (12, 'Franklin', 'Hayes', '615 Circle Road', 'Anytown', 'NY', '11111', '518-555-1212'), (13, 'Peter', 'Johnson', '22 Rose Court', 'Next Town', 'NJ', '18888', '209-555-1313'), (14, 'Peter', 'Johnson', '881 Front Street', 'Next Town', 'NJ', '18888', '209-555-1414'), (15, 'John', 'Smith', '881 Manor Lane', 'Next Town', 'NJ', '18888', '209-555-1515'); -- Table structure for table `sale` -- CREATE TABLE `sale` ( `sale_id` int(11) NOT NULL, `customer_numb` int(11) DEFAULT NULL, `sale_date` date DEFAULT NULL, `sale_total_amt` decimal(8,2) DEFAULT NULL, `credit_card_numb` char(20) DEFAULT NULL, `exp_month` int(11) DEFAULT NULL, `exp_year` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `sale` -- INSERT INTO `sale` (`sale_id`, `customer_numb`, `sale_date`, `sale_total_amt`, `credit_card_numb`, `exp_month`, `exp_year`) VALUES (1, 1, '2021-10-13', '510.00', '1234 5678 9101 1121', 10, 18), (2, 1, '2021-01-05', '125.00', '1234 5678 9101 1121', 10, 18), (3, 1, '2021-06-15', '58.00', '1234 5678 9101 1121', 10, 18), (4, 4, '2021-06-30', '110.00', '1234 5678 9101 5555', 7, 17), (5, 6, '2021-06-30', '110.00', '1234 5678 9101 6666', 12, 17), (6, 12, '2021-07-05', '505.00', '1234 5678 9101 7777', 7, 16), (7, 8, '2021-07-05', '80.00', '1234 5678 9101 8888', 8, 16), (8, 5, '2021-07-07', '90.00', '1234 5678 9101 9999', 9, 15), (9, 8, '2021-07-07', '50.00', '1234 5678 9101 8888', 8, 16), (10, 11, '2021-07-10', '125.00', '1234 5678 9101 1010', 11, 16), (11, 9, '2020-07-10', '200.00', '1234 5678 9101 0909', 11, 15), (12, 10, '2021-07-10', '200.00', '1234 5678 9101 0101', 10, 15), (13, 2, '2021-07-10', '25.95', '1234 5678 9101 2222', 2, 15), (14, 6, '2021-07-10', '80.00', '1234 5678 9101 6666', 12, 17), (15, 11, '2021-07-12', '75.00', '1234 5678 9101 1231', 11, 17), (16, 2, '2021-07-25', '130.00', '1234 5678 9101 2222', 2, 15), (17, 1, '2021-07-25', '100.00', '1234 5678 9101 1121', 10, 18), (18, 5, '2021-08-22', '100.00', '1234 5678 9101 9999', 9, 15), (19, 6, '2021-09-01', '95.00', '1234 5678 9101 7777', 7, 16), (20, 2, '2021-09-01', '75.00', '1234 5678 9101 2222', 2, 15);
Use a sub query to find customers (first and last names) who did not purchase anything on July 10, 2021.
Below are the Data/ Information -- Table structure for table `customer`
CREATE TABLE `customer` (
`customer_numb` int(11) NOT NULL,
`first_name` varchar(30) DEFAULT NULL,
`last_name` varchar(30) DEFAULT NULL,
`street` varchar(50) DEFAULT NULL,
`city` varchar(30) DEFAULT NULL,
`state_province` char(2) DEFAULT NULL,
`zip_postcode` char(10) DEFAULT NULL,
`contact_phone` char(12) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `customer`
--
INSERT INTO `customer` (`customer_numb`, `first_name`, `last_name`, `street`, `city`, `state_province`, `zip_postcode`, `contact_phone`) VALUES
(1, 'Janice', 'Jones', '125 Center Road', 'Anytown', 'NY', '11111', '518-555-1111'),
(2, 'Jon', 'Jones', '25 Elm Road', 'Next Town', 'NJ', '18888', '209-555-2222'),
(3, 'John', 'Doe', '821 Elm Street', 'Next Town', 'NJ', '18888', '209-555-3333'),
(4, 'Jane', 'Doe', '852 Main Street', 'Anytown', 'NY', '11111', '518-555-4444'),
(5, 'Jane', 'Smith', '1919 Main Street', 'New Village', 'NY', '13333', '518-555-5555'),
(6, 'Janice', 'Smith', '800 Center Road', 'Anytown', 'NY', '11111', '518-555-6666'),
(7, 'Helen', 'Brown', '25 Front Street', 'Anytown', 'NY', '11111', '518-555-7777'),
(8, 'Helen', 'Jerry', '16 Main Street', 'Newtown', 'NJ', '18886', '209-555-8888'),
(9, 'Mary', 'Collins', '301 Pine Road, Apt. 12', 'Newtown', 'NJ', '18886', '209-555-9999'),
(10, 'Peter', 'Collins', '18 Main Street', 'Newtown', 'NJ', '18886', '209-555-1010'),
(11, 'Edna', 'Hayes', '209 Circle Road', 'Anytown', 'NY', '11111', '518-555-1110'),
(12, 'Franklin', 'Hayes', '615 Circle Road', 'Anytown', 'NY', '11111', '518-555-1212'),
(13, 'Peter', 'Johnson', '22 Rose Court', 'Next Town', 'NJ', '18888', '209-555-1313'),
(14, 'Peter', 'Johnson', '881 Front Street', 'Next Town', 'NJ', '18888', '209-555-1414'),
(15, 'John', 'Smith', '881 Manor Lane', 'Next Town', 'NJ', '18888', '209-555-1515');
-- Table structure for table `sale`
--
CREATE TABLE `sale` (
`sale_id` int(11) NOT NULL,
`customer_numb` int(11) DEFAULT NULL,
`sale_date` date DEFAULT NULL,
`sale_total_amt` decimal(8,2) DEFAULT NULL,
`credit_card_numb` char(20) DEFAULT NULL,
`exp_month` int(11) DEFAULT NULL,
`exp_year` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `sale`
--
INSERT INTO `sale` (`sale_id`, `customer_numb`, `sale_date`, `sale_total_amt`, `credit_card_numb`, `exp_month`, `exp_year`) VALUES
(1, 1, '2021-10-13', '510.00', '1234 5678 9101 1121', 10, 18),
(2, 1, '2021-01-05', '125.00', '1234 5678 9101 1121', 10, 18),
(3, 1, '2021-06-15', '58.00', '1234 5678 9101 1121', 10, 18),
(4, 4, '2021-06-30', '110.00', '1234 5678 9101 5555', 7, 17),
(5, 6, '2021-06-30', '110.00', '1234 5678 9101 6666', 12, 17),
(6, 12, '2021-07-05', '505.00', '1234 5678 9101 7777', 7, 16),
(7, 8, '2021-07-05', '80.00', '1234 5678 9101 8888', 8, 16),
(8, 5, '2021-07-07', '90.00', '1234 5678 9101 9999', 9, 15),
(9, 8, '2021-07-07', '50.00', '1234 5678 9101 8888', 8, 16),
(10, 11, '2021-07-10', '125.00', '1234 5678 9101 1010', 11, 16),
(11, 9, '2020-07-10', '200.00', '1234 5678 9101 0909', 11, 15),
(12, 10, '2021-07-10', '200.00', '1234 5678 9101 0101', 10, 15),
(13, 2, '2021-07-10', '25.95', '1234 5678 9101 2222', 2, 15),
(14, 6, '2021-07-10', '80.00', '1234 5678 9101 6666', 12, 17),
(15, 11, '2021-07-12', '75.00', '1234 5678 9101 1231', 11, 17),
(16, 2, '2021-07-25', '130.00', '1234 5678 9101 2222', 2, 15),
(17, 1, '2021-07-25', '100.00', '1234 5678 9101 1121', 10, 18),
(18, 5, '2021-08-22', '100.00', '1234 5678 9101 9999', 9, 15),
(19, 6, '2021-09-01', '95.00', '1234 5678 9101 7777', 7, 16),
(20, 2, '2021-09-01', '75.00', '1234 5678 9101 2222', 2, 15);
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images