Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Show the total employee in the employees table . 2. Find the employees with multiple records with same email (Hint: using Having) 3. How

1. Show the total employee in the employees table .

2. Find the employees with multiple records with same email (Hint: using Having)

3. How many unique orders in the orderdetails table.

4.List the latest ten orders in the orderdetails table.

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
CREATE DATABASE IF NOT EXISTS cis495' DEFAULT CHARACTER SET latini ; USE `cis495; /*Table structure for table 'offices */ DROP TABLE IF EXISTS offices; CREATE TABLE 'offices ( officeCode' varchar(10) NOT NULL, "city" varchar(50) NOT NULL, phone varchar(50) NOT NULL, addressLine1 varchar(50) NOT NUL addressLine2 varchar(50) DEFAULT NULL "state" varchar(50) DEFAULT NULL, *country varchar(50) NOT NULL, postalCode varchar(15) NOT NULL, territory varchar(10) NOT NULL, PRIMARY KEY ( officeCode) > ENGINE-InnoDB DEFAULT CHARSET=latini; /*Data for the table offices. */ insert into offices* (*officeCode","city', 'phone', 'addressLine1", "addressLine2","st- /*Table structure for table 'orders DROP TABLE IF EXISTS "orders"; CREATE TABLE orders orderNumber" int(11) NOT NULL, orderDate date NOT NULL, requiredDate date NOT NULL, shippedDate date DEFAULT NULL, "status" varchar(15) NOT NULL, comments text, customer Number int(11) NOT NULL, PRIMARY KEY (order Number"), KEY customer Number (*customer Number), CONSTRAINT orders_ibfk_1 FOREIGN KEY ("customer Number") REFERENCES customers ("customerlumber) ) ENGINE-InnoDB DEFAULT CHARSET=latini; /*Data for the table orders */ insert into orders" ("orderNumber","orderDate', 'requiredDate, shippedDate', status', comments values (10100, 2003-81-86', '2003-81-13, 2003-01-18", "Shipped,NULL, 363),(10101, 2003-81-89', 2003-01-18', /*Table structure for table productlines */ DROP TABLE IF EXISTS"productlines; customer CREATE TABLE "product lines ( "productLine varchar(58) NOT NULL, *textDescription" varchar(4000) DEFAULT NULL, html Description mediumtext X Updated mysqlsampl. not connected DROP TABLE IF EXISTS "productlines; CREATE TABLE `productlines ( 'productLine varchar(50) NOT NULL, "textDescription varchar(4000) DEFAULT NULL, "htmlDescriptionmediumtext, "image' mediumblob, PRIMARY KEY ( productLine) ) ENGINE-InnoDB DEFAULT CHARSET=latini; /*Data for the table productlines / insert into productlines ('productLine, 'textDescription","htmlDescription","image") values Classic Cars, Ateneon car onthusiasts. Make your wildest car onership dreams come t /*Table structure for table products/ DROP TABLE IF EXISTS products"; CREATE TABLE products ( *product Code varchar(15) NOT NULL, "productName" varchar(70) NOT NULL, productLine varchar(50) NOT NULL, productScale varchar(10) NOT NULL, *productVendor* varchar(50) NOT NULL, product Description text NOT NULL, quantityInStock smallint(6) NOT NULL, *buyPrice* decimal(10,2) NOT NULL, MSRP decimal(1.2) NOT NULL 150% Disconnected tent SUO Window Help QuickLaunch (Chic da. Wow Query Excite la At 8BB 8 lated mysqlamp - not connected MSRP decimal(10,2) NOT NULL, PRIMARY KEY (product Code), KEY "productLine productLine), CONSTRAINT products_ibfk_1 FOREIGN KEY "productLine) REFERENCES productlines ('productLine) ) ENGINE-InnoDB DEFAULT CHARSET-latin; /*Data for the table products */ insert into products (product Code', productName", productLine, productscale,productVendor productDescription, quantityInStock", "buyPrice', 'MSRP") values ('510_1678', '1969 Harley Davidson vltim. DROP TABLE IF EXISTS orderdetails; CREATE TABLE orderdetails orderNumber" int(11) NOT NULL, product Code varchar(15) NOT NULL, quantityOrdered" int(11) NOT NULL, priceEach decimal(10,2) NOT NULL, orderlineNumber* smallint(6) NOT NULL, PRIMARY KEY ( order Number","productCode), KEY"product Code ("productCode), CONSTRAINT orderdetails_1bfk_1" FOREIGN KEY (order Number) REFERENCES orders (orderNumber"), CONSTRAINT orderdetails_1bfk_2* FOREIGN KEY ('productCode") REFERENCES products product Code) ) ENGINE=InnoDB DEFAULT CHARSET=latini; (*Data for the table 'orderdetails */ Quick Launch Curl sql-not connected - Microsoft SQL Server Management Studio Tools Window Help New Query A a 2.. Decute 6 Updated mamp.not connected 7*Data for the table 'orderdetails *D.. I AL 3 3 3 insert into 'orderdetails ("orderNumber","productCode", "quantityOrdered","priceEach, orderlineNumber) values (10100, 'S18_1749,30, '136.00',3), (10180, 'S18_2248',50,'55.99', 2),(19100, 'S18_4409,22,'75.46',4), (10100, 'S24_3969,49,'35.29',1),(10101, 'S18_2325', 25, '108.06',4),(10101, 'S18_2795',26, 167.66',1),(10101, "S24_1937,45,'32.53',3),(10101, 'S24_2022',46,44.35', 2), (10102, 518_1342", 39, '95.55',2), (10102, 'S18_1367", 41,-43.13',1),(10103, 'S18_1949',26,214.30', 11), (10103, 'S10_4962',42, '119.67",4), (10103, 'S12_1666',27, '121.64 /*Table structure for table "payments */ DROP TABLE IF EXISTS payments"; CREATE TABLE `payments ( customerNumber int(11) NOT NULL, checkNumber" varchar(50) NOT NULL, payment Date* date NOT NULL, amount decimal(10,2) NOT NULL, PRIMARY KEY ( customer Number", "checkNumber"), CONSTRAINT "payments_1bfk_1" FOREIGN KEY ( customer Number*) REFERENCES customers customer Number) ) ENGINE=InnoDB DEFAULT CHARSET-latini; /*Data for the table "payments */ insert into payments ('customer Number*,'checkNumber, paymentDate, amount) values (103, 'HQ336336', '2004-10-19', '6866.78'), (103,'JM555205', '2003-06-05', '14571.44), (103, 'OM314933', '2004-12-18', '1676.14'), (112, 'B0864823','2004-12-17', '14191.12'), 112, 'HQ55022', '2003-06-06', 32641.98'), (112, ND748579', 2004-08-20, 133347.88'), (114, 'GG31455 2003-05-20 CREATE DATABASE IF NOT EXISTS cis495' DEFAULT CHARACTER SET latini ; USE `cis495; /*Table structure for table 'offices */ DROP TABLE IF EXISTS offices; CREATE TABLE 'offices ( officeCode' varchar(10) NOT NULL, "city" varchar(50) NOT NULL, phone varchar(50) NOT NULL, addressLine1 varchar(50) NOT NUL addressLine2 varchar(50) DEFAULT NULL "state" varchar(50) DEFAULT NULL, *country varchar(50) NOT NULL, postalCode varchar(15) NOT NULL, territory varchar(10) NOT NULL, PRIMARY KEY ( officeCode) > ENGINE-InnoDB DEFAULT CHARSET=latini; /*Data for the table offices. */ insert into offices* (*officeCode","city', 'phone', 'addressLine1", "addressLine2","st- /*Table structure for table 'orders DROP TABLE IF EXISTS "orders"; CREATE TABLE orders orderNumber" int(11) NOT NULL, orderDate date NOT NULL, requiredDate date NOT NULL, shippedDate date DEFAULT NULL, "status" varchar(15) NOT NULL, comments text, customer Number int(11) NOT NULL, PRIMARY KEY (order Number"), KEY customer Number (*customer Number), CONSTRAINT orders_ibfk_1 FOREIGN KEY ("customer Number") REFERENCES customers ("customerlumber) ) ENGINE-InnoDB DEFAULT CHARSET=latini; /*Data for the table orders */ insert into orders" ("orderNumber","orderDate', 'requiredDate, shippedDate', status', comments values (10100, 2003-81-86', '2003-81-13, 2003-01-18", "Shipped,NULL, 363),(10101, 2003-81-89', 2003-01-18', /*Table structure for table productlines */ DROP TABLE IF EXISTS"productlines; customer CREATE TABLE "product lines ( "productLine varchar(58) NOT NULL, *textDescription" varchar(4000) DEFAULT NULL, html Description mediumtext X Updated mysqlsampl. not connected DROP TABLE IF EXISTS "productlines; CREATE TABLE `productlines ( 'productLine varchar(50) NOT NULL, "textDescription varchar(4000) DEFAULT NULL, "htmlDescriptionmediumtext, "image' mediumblob, PRIMARY KEY ( productLine) ) ENGINE-InnoDB DEFAULT CHARSET=latini; /*Data for the table productlines / insert into productlines ('productLine, 'textDescription","htmlDescription","image") values Classic Cars, Ateneon car onthusiasts. Make your wildest car onership dreams come t /*Table structure for table products/ DROP TABLE IF EXISTS products"; CREATE TABLE products ( *product Code varchar(15) NOT NULL, "productName" varchar(70) NOT NULL, productLine varchar(50) NOT NULL, productScale varchar(10) NOT NULL, *productVendor* varchar(50) NOT NULL, product Description text NOT NULL, quantityInStock smallint(6) NOT NULL, *buyPrice* decimal(10,2) NOT NULL, MSRP decimal(1.2) NOT NULL 150% Disconnected tent SUO Window Help QuickLaunch (Chic da. Wow Query Excite la At 8BB 8 lated mysqlamp - not connected MSRP decimal(10,2) NOT NULL, PRIMARY KEY (product Code), KEY "productLine productLine), CONSTRAINT products_ibfk_1 FOREIGN KEY "productLine) REFERENCES productlines ('productLine) ) ENGINE-InnoDB DEFAULT CHARSET-latin; /*Data for the table products */ insert into products (product Code', productName", productLine, productscale,productVendor productDescription, quantityInStock", "buyPrice', 'MSRP") values ('510_1678', '1969 Harley Davidson vltim. DROP TABLE IF EXISTS orderdetails; CREATE TABLE orderdetails orderNumber" int(11) NOT NULL, product Code varchar(15) NOT NULL, quantityOrdered" int(11) NOT NULL, priceEach decimal(10,2) NOT NULL, orderlineNumber* smallint(6) NOT NULL, PRIMARY KEY ( order Number","productCode), KEY"product Code ("productCode), CONSTRAINT orderdetails_1bfk_1" FOREIGN KEY (order Number) REFERENCES orders (orderNumber"), CONSTRAINT orderdetails_1bfk_2* FOREIGN KEY ('productCode") REFERENCES products product Code) ) ENGINE=InnoDB DEFAULT CHARSET=latini; (*Data for the table 'orderdetails */ Quick Launch Curl sql-not connected - Microsoft SQL Server Management Studio Tools Window Help New Query A a 2.. Decute 6 Updated mamp.not connected 7*Data for the table 'orderdetails *D.. I AL 3 3 3 insert into 'orderdetails ("orderNumber","productCode", "quantityOrdered","priceEach, orderlineNumber) values (10100, 'S18_1749,30, '136.00',3), (10180, 'S18_2248',50,'55.99', 2),(19100, 'S18_4409,22,'75.46',4), (10100, 'S24_3969,49,'35.29',1),(10101, 'S18_2325', 25, '108.06',4),(10101, 'S18_2795',26, 167.66',1),(10101, "S24_1937,45,'32.53',3),(10101, 'S24_2022',46,44.35', 2), (10102, 518_1342", 39, '95.55',2), (10102, 'S18_1367", 41,-43.13',1),(10103, 'S18_1949',26,214.30', 11), (10103, 'S10_4962',42, '119.67",4), (10103, 'S12_1666',27, '121.64 /*Table structure for table "payments */ DROP TABLE IF EXISTS payments"; CREATE TABLE `payments ( customerNumber int(11) NOT NULL, checkNumber" varchar(50) NOT NULL, payment Date* date NOT NULL, amount decimal(10,2) NOT NULL, PRIMARY KEY ( customer Number", "checkNumber"), CONSTRAINT "payments_1bfk_1" FOREIGN KEY ( customer Number*) REFERENCES customers customer Number) ) ENGINE=InnoDB DEFAULT CHARSET-latini; /*Data for the table "payments */ insert into payments ('customer Number*,'checkNumber, paymentDate, amount) values (103, 'HQ336336', '2004-10-19', '6866.78'), (103,'JM555205', '2003-06-05', '14571.44), (103, 'OM314933', '2004-12-18', '1676.14'), (112, 'B0864823','2004-12-17', '14191.12'), 112, 'HQ55022', '2003-06-06', 32641.98'), (112, ND748579', 2004-08-20, 133347.88'), (114, 'GG31455 2003-05-20

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

explain the concept of strategy formulation

Answered: 1 week ago

Question

Explain Intermediate term financing in detail.

Answered: 1 week ago

Question

Types of cultural maps ?

Answered: 1 week ago

Question

Discuss the various types of leasing.

Answered: 1 week ago

Question

Define the term "Leasing"

Answered: 1 week ago

Question

Understand why customers are loyal to a particular service firm.

Answered: 1 week ago