Question
for these tables, I need much SQL queries -view -join -procedure CREATE TABLE customer( customer_id int primary key, phone_number varchar(15) , first_name VARCHAR(30) , second_name
for these tables, I need much SQL queries -view
-join
-procedure
CREATE TABLE customer( customer_id int primary key, phone_number varchar(15) , first_name VARCHAR(30) , second_name VARCHAR(30) not NULL, address VARCHAR(30) , email VARCHAR(30) not NULL ); insert into customer values(1, 0594232674, 'john', 'smith', 'london' , 'john@ss.com'); insert into customer values(2, 0593754514, 'Weldon', 'Simon' , 'La Tuque (CA)' , 'stellajohnson87@h'); insert into customer values(3, 0593002506, 'Alexis', 'Barry' , 'Corpus Christi (US)', 'sophiaparker77@h'); insert into customer values(4, 0592696934, 'Vickie', 'Yoder' , 'Bingley (UK)' , 'charlesperez26@h'); insert into customer values(5, 0596259694, 'Brandi', 'Gibbs' , 'Bendigo (AU)' , 'cesarlewis49@sm'); insert into customer values(6, 0599842320, 'Darron', 'Costa' , 'Hoquiam (US)' , 'hannahperez59@y'); insert into customer values(7, 0599842320, 'Hassan', 'Eaton' , 'Morgan City (US)' , 'emmymitchell60@us.s'); insert into customer values(8, 0596454647, 'Jennie', 'Weeks' , 'Beacon (US)' , 'matthewlopez19@'org); insert into customer values(9, 0598813330, 'Robert', 'Glass' , 'Peterborough (US)' , 'jaydengagnon89@ss'); insert into customer values(10, 0599300465, 'Thelma', 'Stark' , 'Seaside (US)' , 'larrymiller51@h');
create table seller( seller_id int primary key, seller_name varchar(30) , address varchar(30) not NULL, product_name varchar(30) ); insert into seller values(478, 'Kristen', 'Tillamook (US)' , 'LIGE 2020'); insert into seller values(479, 'Jillian', 'Yarmouth (CA)' , 'KINDLOV 112'); insert into seller values(480, 'Tabitha', 'Yateley (UK)' , 'SHAREFUNBAY E88 pro'); insert into seller values(481, 'Gregory', 'Romford (UK)' , 'TWS Bluetooth 5.0 Earphones'); insert into seller values(482, 'Millard', 'Berlin (US)' , 'MIUI 1.2L'); insert into seller values(483, 'Kathryn', 'Birchwood (UK)' , 'ENCHEN Boost Hair'); insert into seller values(484, 'Susanne', 'Calais (US)' , '50L Large Capacity bag'); insert into seller values(485, 'Cameron', 'Caldwell (US)' , 'WOSAWE Men Padded'); insert into seller values(486, 'Augusta', 'Caistor (UK)' , 'E-ACE Car Dvr 12 Inch'); insert into seller values(487, 'Juanita', 'Kaneohe (US)' , '70mai Smart Dash Cam 4K');
CREATE TABLE product( product_id int primary key, seller_id int, seller_name VARCHAR(30) , product_name VARCHAR(30) not null, details varchar (50) not null, FOREIGN key (seller_id) REFERENCES seller(seller_id) );
insert into product values( 39518, 478, 'Sofia', 'LIGE 2020' , 'one, meduim and metal' ); insert into product values( 39519, 479, 'Bryon', 'KINDLOV 112' , 'several pieces snd good' ); insert into product values( 39520, 480, 'Jules', 'SHAREFUNBAY E88 pro' , 'one, small and fly away' ); insert into product values( 39521, 482, 'Huynh', 'MIUI 1.2L' , 'one, big and against water' ); insert into product values( 39522, 481, 'Watts', 'TWS Bluetooth 5.0 Earphones', 'twice, small and against water' ); insert into product values( 39523, 483, 'Juana', 'ENCHEN Boost Hair' , 'one, meduim, Several degrees and against water' ); insert into product values( 39524, 485, 'Bruce', 'WOSAWE Men Padded' , 'one, meduim, nice to cloth it and against water' ); insert into product values( 39525, 486, 'Tonia', 'E-ACE Car Dvr 12 Inch' , 'one, big and high quality' ); insert into product values( 39526, 487, 'Kirby', '70mai Smart Dash Cam 4K' , 'one, big and high quality' ); insert into product values( 39527, 484, 'Cathy', '50L Large Capacity bag' , 'one, large, many slots and against water' );
create table orders( order_id int PRIMARY key, product_id int, confirmation_payment varchar(30), address varchar(30), shipment_company varchar(30), FOREIGN key (product_id) REFERENCES product (product_id) );
insert into orders values(34700, 39518, 'Yes' , 'La Tuque (CA)' , 'Bogan, Koelpin and Ondricka'); insert into orders values(34701, 39519, 'Yes' , 'gaza' , 'Cormier, Grimes and Runte'); insert into orders values(34702, 39520, 'No' , 'Corpus Christi (US)', 'Doyle LLC'); insert into orders values(34703, 39521, 'No' , 'Bingley (UK)' , 'Cronin Inc'); insert into orders values(34704, 39522, 'NO' , 'Bendigo (AU)' , 'Bashirian, Cronin and Toy'); insert into orders values(34705, 39523, 'Yes' , 'Hoquiam (US)' , 'Hauck - Miller'); insert into orders values(34706, 39524, 'Yes' , 'Morgan City (US)' , 'Vandervort - Wiegand'); insert into orders values(34707, 39525, 'No' , 'Beacon (US)' , 'Kohler - Pouros'); insert into orders values(34708, 39526, 'Yes' , 'Peterborough (US)' , 'Ankunding, Emard and Runte'); insert into orders values(34709, 39527, 'Yes' , 'Seaside (US)' , 'Stark - Armstrong');
create table category( category_id int primary key, seller_id int, category_name varchar(30) not NULL, description varchar (200), FOREIGN key (seller_id) REFERENCES seller(seller_id) );
insert into category values(1140, 478, 'Wristwatch' , 'Men's Watches with Stainless Steel Top Brand Luxury Sports Chronograph Quartz Watch Men Relogio Masculino'); insert into category values(1141, 479, 'Precision Mobile Repair' , 'set_of Screw Driver Bit_Set Multi_function Precision Mobile Phone Repair Device Hand Tools Torx Hex'); insert into category values(1142, 480, 'camera drone' , 'drone 4k HD dual-camera visual positioning 1080P WiFi fpv drone height preservation RC quadcopter'); insert into category values(1143, 481, 'Earphones' , 'Earphones 2200mAh Charging Box Wireless Headphone 9D Stereo Sports Waterproof Earbuds Headsets With Microphone'); insert into category values(1144, 482, 'Blender Electric Fruit Juicer', 'Fruit Juicer Mixer Food Processor Ice Smoothie & Hot Soup Blender _with Glass Cup & Auto_matic Timer'); insert into category values(1145, 483, 'Electric Hair Clipper Cutter' , 'Hair Trimmer For Men Kids Cordless USB Rechargeable Electric Hair Clipper Cutter Machine With Adjustable Comb'); insert into category values(1146, 484, 'Back Bag' , 'Men Army Backpack Tactical Army Military Assault Waterproof Trekking Camping Hunting 3P Softback Sports Bags'); insert into category values(1147, 485, 'Cycling Shorts' , 'Mountain Bike Bicycle Riding Trousers Water Resistant Loose Fit Shorts'); insert into category values(1148, 486, 'Car accessories' , '12 Inch Rearview Mirror 4G Android 8.1 Dash Cam GPS Navigation Auto Registrar Video Recorder support Rear Camera'); insert into category values(1149, 487, 'Drone' , 'Cam 4K A800 Built-in GPS ADAS 70mai Real 4K Car DVR UHD Cinema-quality Image 24H Parking SONY IMX415 140FOV');
create table purchase( customer_id int, product_id int, order_id int, FOREIGN key (customer_id) REFERENCES customer (customer_id), FOREIGN key (product_id) REFERENCES product (product_id), FOREIGN key (order_id) REFERENCES orders (order_id) );
insert into purchase values( 1 , 39519, 34701); insert into purchase values( 2 , 39518, 34700); insert into purchase values( 3 , 39520, 34702); insert into purchase values( 4 , 39521, 34703); insert into purchase values( 5 , 39522, 34704); insert into purchase values( 6 , 39523, 34705); insert into purchase values( 7 , 39524, 34706); insert into purchase values( 8 , 39525, 34707); insert into purchase values( 9 , 39526, 34708); insert into purchase values( 10, 39527, 34709);
create table details(
customer_id int, product_id int, order_id int, quantity int not null, price varchar(10) not null, FOREIGN key (customer_id) REFERENCES customer (customer_id), FOREIGN key (product_id) REFERENCES product (product_id), FOREIGN key (order_id) REFERENCES orders (order_id) );
insert into details values( 1 , 39519, 34701, 38, '20 $' ); insert into details values( 2 , 39518, 34700, 12, '50 $' ); insert into details values( 3 , 39520, 34702, 28, '70 $' ); insert into details values( 4 , 39521, 34703, 45, '48 $' ); insert into details values( 5 , 39522, 34704, 38, '99 $' ); insert into details values( 6 , 39523, 34705, 39, '14 $' ); insert into details values( 7 , 39524, 34706, 28, '25 $' ); insert into details values( 8 , 39525, 34707, 22, '12 $' ); insert into details values( 9 , 39526, 34708, 19, '63 $' ); insert into details values( 10, 39527, 34709, 47, '42 $' );
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started