SlideShare a Scribd company logo
CompanyDB Problems page 1 of 3
Consider the employee database of Figure CompanyDB:
*************************************************
* employee (employee_name, street, city) *
* works (employee_name, company_name, salary) *
* company (company_name, city) *
* manages (employee_name, manager_name) *
*************************************************
Figure CompanyDB.
Using the course database, give an expression in SQL for each
of the following queries. The expected results are indicated for
each query.
a. Find the names of all employees who work for First Bank
Corporation.
EMPLOYEE_NAME
--------------------
Ferris
Johnson
Laikin
Moira
Turner
b. Find the names and cities of residence of all employees who
work for First Bank Corporation.
EMPLOYEE_NAME CITY
-------------------- --------------------
Ferris Westchester
Johnson Palo Alto
Laikin Culver City
Moira Kentwood
Turner Palo Alto
c. Find the names, street address, and cities of residence of all
employees who work for First Bank Corporation and earn more
than $10,000.
EMPLOYEE_NAME STREET CITY
-------------------- ------------------------------ --------------------
Ferris Loyola Westchester
Johnson Alma Palo Alto
Laikin Berryman Culver City
Moira Nancy Kentwood
Turner Alma Palo Alto
d. Find all employees in the database who live in the same cities
as the companies for which they work.
EMPLOYEE_NAME
--------------------
August
Brooks
Curry
Hayes
Jones
Smith
e. Find all employees in the database who live in the same cities
and on the same streets as do their managers.
EMPLOYEE_NAME
--------------------
Curry
Lindsay
Turner
Williams
f. Find all employees in the database who do not work for First
Bank Corporation
EMPLOYEE_NAME
--------------------
Adams
August
Brooks
Curry
Glenn
Green
Hayes
Jones
Lindsay
Schmidt
Smith
Williams
Young
g. Find all employees in the database who earn more than every
employee of Small Bank Corporation.
EMPLOYEE_NAME SALARY
-------------------- ---------
August 150000.00
Schmidt 120000.00
h. Assume that the companies may be located in several cities.
Find all companies located in every city in which Small Bank
Corporation is located
COMPANY_NAME
------------------------------
Small Bank Corporation
i. Find all employees who earn more than the average salary of
all employees of their company.
EMPLOYEE_NAME
--------------------
Adams
August
Brooks
Ferris
Glenn
Green
Johnson
Laikin
j. Find the company that has the most employees. Show the
company name and number of employees.
COMPANY_NAME COUNT(DISTINCT employee_name)
------------------------------ -----------------------------
First Bank Corporation 5
k. Find the company that has the smallest payroll.
COMPANY_NAME
------------------------------
Cathedral Software
l. Find those companies whose employees earn a higher salary,
on average, than the average salary at First Bank Corporation.
COMPANY_NAME
------------------------------
IBM
Integrated Data Systems
Multnomah Software
Small Bank Corporation
Sneakers
saugust-CompanyDB-DROP.sql
DROP TABLE IF EXISTS works
;
DROP TABLE IF EXISTS works2
;
DROP TABLE IF EXISTS manages
;
DROP TABLE IF EXISTS manages2
;
DROP TABLE IF EXISTS company
;
DROP TABLE IF EXISTS company2
;
DROP TABLE IF EXISTS employee
;
DROP TABLE IF EXISTS employee2
;
__MACOSX/._saugust-CompanyDB-DROP.sql
saugust-CompanyDB.sql
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET
@[email protected]@CHARACTER_SET_CLIENT */;
/*!40101 SET
@OLD_CHARACTER_SE[email protected]@CHARACTER_SE
T_RESULTS */;
/*!40101 SET
@[email protected]@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
-- --------------------------------------------------------
--
-- Table structure for table `company`
--
CREATE TABLE IF NOT EXISTS `company` (
`company_name` varchar(30) NOT NULL DEFAULT '',
`city` varchar(20) DEFAULT NULL,
PRIMARY KEY (`company_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `company`
--
INSERT INTO `company` (`company_name`, `city`) VALUES
('Cathedral Software', 'San Francisco'),
('First Bank Corporation', 'Brooklyn'),
('IBM', 'San Jose'),
('Integrated Data Systems', 'Westchester'),
('Multnomah Software', 'Westchester'),
('Small Bank Corporation', 'Palo Alto'),
('Sneakers', 'Chicago');
-- --------------------------------------------------------
--
-- Table structure for table `company2`
--
CREATE TABLE IF NOT EXISTS `company2` (
`company_name` varchar(30) NOT NULL DEFAULT '',
`city` varchar(20) NOT NULL DEFAULT '',
PRIMARY KEY (`company_name`,`city`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `company2`
--
INSERT INTO `company2` (`company_name`, `city`) VALUES
('August Software', 'Westchester'),
('Cathedral Software', 'Palo Alto'),
('Cathedral Software', 'San Francisco'),
('Cathedral Software', 'Santa Clara'),
('First Bank Corporation', 'Brighton'),
('First Bank Corporation', 'Brooklyn'),
('IBM', 'San Jose'),
('IBM', 'Yorktown Heights'),
('Integrated Data Systems', 'Westchester'),
('Small Bank Corporation', 'Palo Alto'),
('Small Bank Corporation', 'Santa Clara');
-- --------------------------------------------------------
--
-- Table structure for table `employee`
--
CREATE TABLE IF NOT EXISTS `employee` (
`employee_name` varchar(20) NOT NULL DEFAULT '',
`street` varchar(30) DEFAULT NULL,
`city` varchar(20) DEFAULT NULL,
PRIMARY KEY (`employee_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `employee`
--
INSERT INTO `employee` (`employee_name`, `street`, `city`)
VALUES
('Adams', 'Nassau', 'Princeton'),
('August', 'Riggs', 'Westchester'),
('Brooks', 'North', 'San Jose'),
('Curry', 'North', 'San Jose'),
('Ferris', 'Loyola', 'Westchester'),
('Glenn', 'Park', 'Pittsfield'),
('Green', 'Walnut', 'Stamford'),
('Hayes', 'Main', 'San Francisco'),
('Johnson', 'Alma', 'Palo Alto'),
('Jones', 'Main', 'San Jose'),
('Laikin', 'Berryman', 'Culver City'),
('Lindsay', 'Park', 'Pittsfield'),
('Moira', 'Nancy', 'Kentwood'),
('Schmidt', 'Nardian', 'Los Angeles'),
('Smith', 'North', 'Westchester'),
('Turner', 'Alma', 'Palo Alto'),
('Williams', 'Nassau', 'Princeton'),
('Young', 'Loyola', 'Westchester');
-- --------------------------------------------------------
--
-- Table structure for table `employee2`
--
CREATE TABLE IF NOT EXISTS `employee2` (
`employee_name` varchar(20) NOT NULL DEFAULT '',
`street` varchar(30) DEFAULT NULL,
`city` varchar(20) DEFAULT NULL,
PRIMARY KEY (`employee_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `employee2`
--
INSERT INTO `employee2` (`employee_name`, `street`, `city`)
VALUES
('Adams', 'Nassau', 'Princeton'),
('August', 'Riggs', 'Westchester'),
('Brooks', 'North', 'San Jose'),
('Cox', 'National', 'Rockville'),
('Curry', 'North', 'San Jose'),
('Draskovic', 'Faraday', 'Reston'),
('Ferris', 'Loyola', 'Westchester'),
('Glenn', 'Park', 'Pittsfield'),
('Green', 'Walnut', 'Stamford'),
('Hayes', 'Main', 'San Francisco'),
('Johnson', 'Alma', 'Palo Alto'),
('Jones', 'Main', 'San Jose'),
('Kent', '80th', 'Culver City'),
('Laikin', 'Berryman', 'Culver City'),
('Lindsay', 'Park', 'Pittsfield'),
('Malcolm', 'Paddock', 'Jurassic Part'),
('Moira', 'Nancy', 'Kentwood'),
('Price', 'Library', 'Reston'),
('Ryan', 'Pennsylvania', 'District of Columbia'),
('Schmidt', 'Nardian', 'Los Angeles'),
('Smith', 'North', 'Westchester'),
('Turner', 'Alma', 'Palo Alto'),
('Williams', 'Nassau', 'Princeton'),
('Woody', 'Emerson', 'Culver City'),
('Young', 'Loyola', 'Westchester');
-- --------------------------------------------------------
--
-- Table structure for table `manages`
--
CREATE TABLE IF NOT EXISTS `manages` (
`employee_name` varchar(20) NOT NULL DEFAULT '',
`manager_name` varchar(20) DEFAULT NULL,
PRIMARY KEY (`employee_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Add foreign key constraint
--
ALTER TABLE manages ADD CONSTRAINT
manages_employee_name_FK
FOREIGN KEY (employee_name)
REFERENCES employee(employee_name)
;
ALTER TABLE manages ADD CONSTRAINT
manages_manager_name_FK
FOREIGN KEY (manager_name)
REFERENCES employee(employee_name)
;
--
-- Dumping data for table `manages`
--
INSERT INTO `manages` (`employee_name`, `manager_name`)
VALUES
('Adams', 'Ferris'),
('Curry', 'Brooks'),
('Glenn', 'Green'),
('Johnson', 'Moira'),
('Jones', 'Brooks'),
('Laikin', 'Adams'),
('Lindsay', 'Glenn'),
('Smith', 'August'),
('Turner', 'Johnson'),
('Williams', 'Adams'),
('Young', 'Glenn');
-- --------------------------------------------------------
--
-- Table structure for table `works`
--
CREATE TABLE IF NOT EXISTS `works` (
`employee_name` varchar(20) NOT NULL DEFAULT '',
`company_name` varchar(30) DEFAULT NULL,
`salary` decimal(8,2) DEFAULT NULL,
PRIMARY KEY (`employee_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Add foreign key constraint
--
ALTER TABLE works ADD CONSTRAINT
works_employee_name_FK
FOREIGN KEY (employee_name)
REFERENCES employee(employee_name)
;
ALTER TABLE works ADD CONSTRAINT
works_company_name_FK
FOREIGN KEY (company_name)
REFERENCES company(company_name)
;
--
-- Dumping data for table `works`
--
INSERT INTO `works` (`employee_name`, `company_name`,
`salary`) VALUES
('Adams', 'Sneakers', 90000.00),
('August', 'Multnomah Software', 150000.00),
('Brooks', 'IBM', 85000.00),
('Curry', 'IBM', 70000.00),
('Ferris', 'First Bank Corporation', 100000.00),
('Glenn', 'Small Bank Corporation', 102000.00),
('Green', 'Small Bank Corporation', 110000.00),
('Hayes', 'Cathedral Software', 60000.00),
('Johnson', 'First Bank Corporation', 99000.00),
('Jones', 'IBM', 75000.00),
('Laikin', 'First Bank Corporation', 91000.00),
('Lindsay', 'Small Bank Corporation', 60000.00),
('Moira', 'First Bank Corporation', 17000.00),
('Schmidt', 'Integrated Data Systems', 120000.00),
('Smith', 'Multnomah Software', 50000.00),
('Turner', 'First Bank Corporation', 30000.00),
('Williams', 'Sneakers', 67000.00),
('Young', 'Small Bank Corporation', 57000.00);
-- --------------------------------------------------------
--
-- Table structure for table `works2`
--
CREATE TABLE IF NOT EXISTS `works2` (
`employee_name` varchar(20) NOT NULL DEFAULT '',
`company_name` varchar(30) NOT NULL DEFAULT '',
`city` varchar(20) NOT NULL DEFAULT '',
`salary` decimal(8,2) DEFAULT NULL,
PRIMARY KEY (`employee_name`,`company_name`,`city`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Add foreign key constraint
--
ALTER TABLE works2 ADD CONSTRAINT
works2_employee_name_FK
FOREIGN KEY (employee_name)
REFERENCES employee(employee_name)
;
ALTER TABLE works2 ADD CONSTRAINT
works2_company_name_FK
FOREIGN KEY (company_name)
REFERENCES company(company_name)
;
--
-- Dumping data for table `works2`
--
INSERT INTO `works2` (`employee_name`, `company_name`,
`city`, `salary`) VALUES
('Adams', 'Sneakers', 'Chicago', 90000.00),
('August', 'Multnomah Software', 'Westchester', 150000.00),
('Brooks', 'IBM', 'San Jose', 85000.00),
('Curry', 'IBM', 'San Jose', 70000.00),
('Ferris', 'First Bank Corporation', 'Brooklyn', 100000.00),
('Glenn', 'Small Bank Corporation', 'Palo Alto', 102000.00),
('Green', 'Small Bank Corporation', 'Palo Alto', 110000.00),
('Hayes', 'Cathedral Software', 'San Francisco', 60000.00),
('Johnson', 'First Bank Corporation', 'Brooklyn', 99000.00),
('Jones', 'IBM', 'San Jose', 75000.00),
('Laikin', 'First Bank Corporation', 'Brooklyn', 91000.00),
('Lindsay', 'Small Bank Corporation', 'Palo Alto', 60000.00),
('Moira', 'First Bank Corporation', 'Brooklyn', 17000.00),
('Moira', 'Multnomah Software', 'Westchester', 67000.00),
('Schmidt', 'Integrated Data Systems', 'Westchester', 120000.00),
('Smith', 'Multnomah Software', 'Westchester', 50000.00),
('Turner', 'First Bank Corporation', 'Brooklyn', 30000.00),
('Williams', 'Sneakers', 'Chicago', 67000.00),
('Young', 'Small Bank Corporation', 'Palo Alto', 57000.00);
/*!40101 SET [email protected]_CHARACTER_SET_CLIENT
*/;
/*!40101 SET [email protected]_CHARACTER_SET_RESULTS
*/;
/*!40101 SET [email protected]_COLLATION_CONNECTION
*/;
__MACOSX/._saugust-CompanyDB.sql

More Related Content

Similar to CompanyDB Problemspage 1 of 3Consider the employee database of .docx

40483130 introduction-to-sql
40483130 introduction-to-sql40483130 introduction-to-sql
40483130 introduction-to-sql
kumarsadasivuni
 
Data Exploration with Apache Drill: Day 2
Data Exploration with Apache Drill: Day 2Data Exploration with Apache Drill: Day 2
Data Exploration with Apache Drill: Day 2
Charles Givre
 
Intro To TSQL - Unit 2
Intro To TSQL - Unit 2Intro To TSQL - Unit 2
Intro To TSQL - Unit 2
iccma
 
Intro to tsql unit 2
Intro to tsql   unit 2Intro to tsql   unit 2
Intro to tsql unit 2Syed Asrarali
 
Cassandra model
Cassandra modelCassandra model
Cassandra model
zqhxuyuan
 
Advanced MySQL Query Tuning
Advanced MySQL Query TuningAdvanced MySQL Query Tuning
Advanced MySQL Query Tuning
Alexander Rubin
 
Chris Mc Glothen Sql Portfolio
Chris Mc Glothen Sql PortfolioChris Mc Glothen Sql Portfolio
Chris Mc Glothen Sql Portfolio
clmcglothen
 
create_workbook_store.sql-- create_store.sql-- Introcution,.docx
create_workbook_store.sql-- create_store.sql-- Introcution,.docxcreate_workbook_store.sql-- create_store.sql-- Introcution,.docx
create_workbook_store.sql-- create_store.sql-- Introcution,.docx
faithxdunce63732
 
第3回 データフレームの基本操作 その1(解答付き)
第3回 データフレームの基本操作 その1(解答付き)第3回 データフレームの基本操作 その1(解答付き)
第3回 データフレームの基本操作 その1(解答付き)
Wataru Shito
 
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
 - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
ssuserfa5723
 
MySQL Built-In Functions
MySQL Built-In FunctionsMySQL Built-In Functions
MySQL Built-In Functions
SHC
 
zen and the art of SQL optimization
zen and the art of SQL optimizationzen and the art of SQL optimization
zen and the art of SQL optimization
Karen Morton
 
set FOREIGN_KEY_CHECKS=false;-- --------------------------.docx
set FOREIGN_KEY_CHECKS=false;-- --------------------------.docxset FOREIGN_KEY_CHECKS=false;-- --------------------------.docx
set FOREIGN_KEY_CHECKS=false;-- --------------------------.docx
klinda1
 
Cassandra, web scale no sql data platform
Cassandra, web scale no sql data platformCassandra, web scale no sql data platform
Cassandra, web scale no sql data platform
Marko Švaljek
 
Er diagram for library database
Er diagram for library databaseEr diagram for library database
Er diagram for library database
Sreedhar Chowdam
 
Seistech SQL code
Seistech SQL codeSeistech SQL code
Seistech SQL codeSimon Hoyle
 
Python Project On Cosmetic Shop system
Python Project On Cosmetic Shop systemPython Project On Cosmetic Shop system
Python Project On Cosmetic Shop system
vikram mahendra
 
3. R- list and data frame
3. R- list and data frame3. R- list and data frame
3. R- list and data frame
krishna singh
 

Similar to CompanyDB Problemspage 1 of 3Consider the employee database of .docx (20)

40483130 introduction-to-sql
40483130 introduction-to-sql40483130 introduction-to-sql
40483130 introduction-to-sql
 
Data Exploration with Apache Drill: Day 2
Data Exploration with Apache Drill: Day 2Data Exploration with Apache Drill: Day 2
Data Exploration with Apache Drill: Day 2
 
Sql ejercicio 1
Sql ejercicio 1Sql ejercicio 1
Sql ejercicio 1
 
Intro To TSQL - Unit 2
Intro To TSQL - Unit 2Intro To TSQL - Unit 2
Intro To TSQL - Unit 2
 
Intro to tsql unit 2
Intro to tsql   unit 2Intro to tsql   unit 2
Intro to tsql unit 2
 
Cassandra model
Cassandra modelCassandra model
Cassandra model
 
Advanced MySQL Query Tuning
Advanced MySQL Query TuningAdvanced MySQL Query Tuning
Advanced MySQL Query Tuning
 
Chris Mc Glothen Sql Portfolio
Chris Mc Glothen Sql PortfolioChris Mc Glothen Sql Portfolio
Chris Mc Glothen Sql Portfolio
 
create_workbook_store.sql-- create_store.sql-- Introcution,.docx
create_workbook_store.sql-- create_store.sql-- Introcution,.docxcreate_workbook_store.sql-- create_store.sql-- Introcution,.docx
create_workbook_store.sql-- create_store.sql-- Introcution,.docx
 
第3回 データフレームの基本操作 その1(解答付き)
第3回 データフレームの基本操作 その1(解答付き)第3回 データフレームの基本操作 その1(解答付き)
第3回 データフレームの基本操作 その1(解答付き)
 
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
 - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
 
MySQL Built-In Functions
MySQL Built-In FunctionsMySQL Built-In Functions
MySQL Built-In Functions
 
zen and the art of SQL optimization
zen and the art of SQL optimizationzen and the art of SQL optimization
zen and the art of SQL optimization
 
set FOREIGN_KEY_CHECKS=false;-- --------------------------.docx
set FOREIGN_KEY_CHECKS=false;-- --------------------------.docxset FOREIGN_KEY_CHECKS=false;-- --------------------------.docx
set FOREIGN_KEY_CHECKS=false;-- --------------------------.docx
 
Cassandra, web scale no sql data platform
Cassandra, web scale no sql data platformCassandra, web scale no sql data platform
Cassandra, web scale no sql data platform
 
Er diagram for library database
Er diagram for library databaseEr diagram for library database
Er diagram for library database
 
Seistech SQL code
Seistech SQL codeSeistech SQL code
Seistech SQL code
 
Python Project On Cosmetic Shop system
Python Project On Cosmetic Shop systemPython Project On Cosmetic Shop system
Python Project On Cosmetic Shop system
 
Sql queries
Sql queriesSql queries
Sql queries
 
3. R- list and data frame
3. R- list and data frame3. R- list and data frame
3. R- list and data frame
 

More from monicafrancis71118

1. Discuss Blockchains potential application in compensation system.docx
1. Discuss Blockchains potential application in compensation system.docx1. Discuss Blockchains potential application in compensation system.docx
1. Discuss Blockchains potential application in compensation system.docx
monicafrancis71118
 
1. Describe the characteristics of the aging process. Explain how so.docx
1. Describe the characteristics of the aging process. Explain how so.docx1. Describe the characteristics of the aging process. Explain how so.docx
1. Describe the characteristics of the aging process. Explain how so.docx
monicafrancis71118
 
1. Dis. 7Should we continue to collect data on race and .docx
1. Dis. 7Should we continue to collect data on race and .docx1. Dis. 7Should we continue to collect data on race and .docx
1. Dis. 7Should we continue to collect data on race and .docx
monicafrancis71118
 
1. Differentiate crisis intervention from other counseling therapeut.docx
1. Differentiate crisis intervention from other counseling therapeut.docx1. Differentiate crisis intervention from other counseling therapeut.docx
1. Differentiate crisis intervention from other counseling therapeut.docx
monicafrancis71118
 
1. Despite our rational nature, our ability to reason well is ofte.docx
1. Despite our rational nature, our ability to reason well is ofte.docx1. Despite our rational nature, our ability to reason well is ofte.docx
1. Despite our rational nature, our ability to reason well is ofte.docx
monicafrancis71118
 
1. Describe the ethical challenges faced by organizations operating .docx
1. Describe the ethical challenges faced by organizations operating .docx1. Describe the ethical challenges faced by organizations operating .docx
1. Describe the ethical challenges faced by organizations operating .docx
monicafrancis71118
 
1. Describe in your own words the anatomy of a muscle.  This sho.docx
1. Describe in your own words the anatomy of a muscle.  This sho.docx1. Describe in your own words the anatomy of a muscle.  This sho.docx
1. Describe in your own words the anatomy of a muscle.  This sho.docx
monicafrancis71118
 
1. Describe how your attitude of including aspects of health literac.docx
1. Describe how your attitude of including aspects of health literac.docx1. Describe how your attitude of including aspects of health literac.docx
1. Describe how your attitude of including aspects of health literac.docx
monicafrancis71118
 
1. Choose a behavior (such as overeating, shopping, Internet use.docx
1. Choose a behavior (such as overeating, shopping, Internet use.docx1. Choose a behavior (such as overeating, shopping, Internet use.docx
1. Choose a behavior (such as overeating, shopping, Internet use.docx
monicafrancis71118
 
1. Case 3-4 Franklin Industries’ Whistleblowing (a GVV Case)Natali.docx
1. Case 3-4 Franklin Industries’ Whistleblowing (a GVV Case)Natali.docx1. Case 3-4 Franklin Industries’ Whistleblowing (a GVV Case)Natali.docx
1. Case 3-4 Franklin Industries’ Whistleblowing (a GVV Case)Natali.docx
monicafrancis71118
 
1. Cryptography is used to protect confidential data in many areas. .docx
1. Cryptography is used to protect confidential data in many areas. .docx1. Cryptography is used to protect confidential data in many areas. .docx
1. Cryptography is used to protect confidential data in many areas. .docx
monicafrancis71118
 
1. Compare and contrast steganography and cryptography.2. Why st.docx
1. Compare and contrast steganography and cryptography.2. Why st.docx1. Compare and contrast steganography and cryptography.2. Why st.docx
1. Compare and contrast steganography and cryptography.2. Why st.docx
monicafrancis71118
 
1. Date September 13, 2017 – September 15, 2017 2. Curr.docx
1. Date September 13, 2017 – September 15, 2017 2. Curr.docx1. Date September 13, 2017 – September 15, 2017 2. Curr.docx
1. Date September 13, 2017 – September 15, 2017 2. Curr.docx
monicafrancis71118
 
1. compare and contrast predictive analytics with prescriptive and d.docx
1. compare and contrast predictive analytics with prescriptive and d.docx1. compare and contrast predictive analytics with prescriptive and d.docx
1. compare and contrast predictive analytics with prescriptive and d.docx
monicafrancis71118
 
1. Creating and maintaining relationships between home and schoo.docx
1. Creating and maintaining relationships between home and schoo.docx1. Creating and maintaining relationships between home and schoo.docx
1. Creating and maintaining relationships between home and schoo.docx
monicafrancis71118
 
1. Compare and contrast Strategic and Tactical Analysis and its .docx
1. Compare and contrast Strategic and Tactical Analysis and its .docx1. Compare and contrast Strategic and Tactical Analysis and its .docx
1. Compare and contrast Strategic and Tactical Analysis and its .docx
monicafrancis71118
 
1. Coalition ProposalVaccination Policy for Infectious Disease P.docx
1. Coalition ProposalVaccination Policy for Infectious Disease P.docx1. Coalition ProposalVaccination Policy for Infectious Disease P.docx
1. Coalition ProposalVaccination Policy for Infectious Disease P.docx
monicafrancis71118
 
1. Company Description and Backgrounda. Weight Watchers was cr.docx
1. Company Description and Backgrounda. Weight Watchers was cr.docx1. Company Description and Backgrounda. Weight Watchers was cr.docx
1. Company Description and Backgrounda. Weight Watchers was cr.docx
monicafrancis71118
 
1. Come up with TWO movie ideas -- as in for TWO screenplays that .docx
1. Come up with TWO movie ideas -- as in for TWO screenplays that .docx1. Come up with TWO movie ideas -- as in for TWO screenplays that .docx
1. Come up with TWO movie ideas -- as in for TWO screenplays that .docx
monicafrancis71118
 
1. Choose a case for the paper that interests you. Most choose a .docx
1. Choose a case for the paper that interests you.  Most choose a .docx1. Choose a case for the paper that interests you.  Most choose a .docx
1. Choose a case for the paper that interests you. Most choose a .docx
monicafrancis71118
 

More from monicafrancis71118 (20)

1. Discuss Blockchains potential application in compensation system.docx
1. Discuss Blockchains potential application in compensation system.docx1. Discuss Blockchains potential application in compensation system.docx
1. Discuss Blockchains potential application in compensation system.docx
 
1. Describe the characteristics of the aging process. Explain how so.docx
1. Describe the characteristics of the aging process. Explain how so.docx1. Describe the characteristics of the aging process. Explain how so.docx
1. Describe the characteristics of the aging process. Explain how so.docx
 
1. Dis. 7Should we continue to collect data on race and .docx
1. Dis. 7Should we continue to collect data on race and .docx1. Dis. 7Should we continue to collect data on race and .docx
1. Dis. 7Should we continue to collect data on race and .docx
 
1. Differentiate crisis intervention from other counseling therapeut.docx
1. Differentiate crisis intervention from other counseling therapeut.docx1. Differentiate crisis intervention from other counseling therapeut.docx
1. Differentiate crisis intervention from other counseling therapeut.docx
 
1. Despite our rational nature, our ability to reason well is ofte.docx
1. Despite our rational nature, our ability to reason well is ofte.docx1. Despite our rational nature, our ability to reason well is ofte.docx
1. Despite our rational nature, our ability to reason well is ofte.docx
 
1. Describe the ethical challenges faced by organizations operating .docx
1. Describe the ethical challenges faced by organizations operating .docx1. Describe the ethical challenges faced by organizations operating .docx
1. Describe the ethical challenges faced by organizations operating .docx
 
1. Describe in your own words the anatomy of a muscle.  This sho.docx
1. Describe in your own words the anatomy of a muscle.  This sho.docx1. Describe in your own words the anatomy of a muscle.  This sho.docx
1. Describe in your own words the anatomy of a muscle.  This sho.docx
 
1. Describe how your attitude of including aspects of health literac.docx
1. Describe how your attitude of including aspects of health literac.docx1. Describe how your attitude of including aspects of health literac.docx
1. Describe how your attitude of including aspects of health literac.docx
 
1. Choose a behavior (such as overeating, shopping, Internet use.docx
1. Choose a behavior (such as overeating, shopping, Internet use.docx1. Choose a behavior (such as overeating, shopping, Internet use.docx
1. Choose a behavior (such as overeating, shopping, Internet use.docx
 
1. Case 3-4 Franklin Industries’ Whistleblowing (a GVV Case)Natali.docx
1. Case 3-4 Franklin Industries’ Whistleblowing (a GVV Case)Natali.docx1. Case 3-4 Franklin Industries’ Whistleblowing (a GVV Case)Natali.docx
1. Case 3-4 Franklin Industries’ Whistleblowing (a GVV Case)Natali.docx
 
1. Cryptography is used to protect confidential data in many areas. .docx
1. Cryptography is used to protect confidential data in many areas. .docx1. Cryptography is used to protect confidential data in many areas. .docx
1. Cryptography is used to protect confidential data in many areas. .docx
 
1. Compare and contrast steganography and cryptography.2. Why st.docx
1. Compare and contrast steganography and cryptography.2. Why st.docx1. Compare and contrast steganography and cryptography.2. Why st.docx
1. Compare and contrast steganography and cryptography.2. Why st.docx
 
1. Date September 13, 2017 – September 15, 2017 2. Curr.docx
1. Date September 13, 2017 – September 15, 2017 2. Curr.docx1. Date September 13, 2017 – September 15, 2017 2. Curr.docx
1. Date September 13, 2017 – September 15, 2017 2. Curr.docx
 
1. compare and contrast predictive analytics with prescriptive and d.docx
1. compare and contrast predictive analytics with prescriptive and d.docx1. compare and contrast predictive analytics with prescriptive and d.docx
1. compare and contrast predictive analytics with prescriptive and d.docx
 
1. Creating and maintaining relationships between home and schoo.docx
1. Creating and maintaining relationships between home and schoo.docx1. Creating and maintaining relationships between home and schoo.docx
1. Creating and maintaining relationships between home and schoo.docx
 
1. Compare and contrast Strategic and Tactical Analysis and its .docx
1. Compare and contrast Strategic and Tactical Analysis and its .docx1. Compare and contrast Strategic and Tactical Analysis and its .docx
1. Compare and contrast Strategic and Tactical Analysis and its .docx
 
1. Coalition ProposalVaccination Policy for Infectious Disease P.docx
1. Coalition ProposalVaccination Policy for Infectious Disease P.docx1. Coalition ProposalVaccination Policy for Infectious Disease P.docx
1. Coalition ProposalVaccination Policy for Infectious Disease P.docx
 
1. Company Description and Backgrounda. Weight Watchers was cr.docx
1. Company Description and Backgrounda. Weight Watchers was cr.docx1. Company Description and Backgrounda. Weight Watchers was cr.docx
1. Company Description and Backgrounda. Weight Watchers was cr.docx
 
1. Come up with TWO movie ideas -- as in for TWO screenplays that .docx
1. Come up with TWO movie ideas -- as in for TWO screenplays that .docx1. Come up with TWO movie ideas -- as in for TWO screenplays that .docx
1. Come up with TWO movie ideas -- as in for TWO screenplays that .docx
 
1. Choose a case for the paper that interests you. Most choose a .docx
1. Choose a case for the paper that interests you.  Most choose a .docx1. Choose a case for the paper that interests you.  Most choose a .docx
1. Choose a case for the paper that interests you. Most choose a .docx
 

Recently uploaded

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 

Recently uploaded (20)

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 

CompanyDB Problemspage 1 of 3Consider the employee database of .docx

  • 1. CompanyDB Problems page 1 of 3 Consider the employee database of Figure CompanyDB: ************************************************* * employee (employee_name, street, city) * * works (employee_name, company_name, salary) * * company (company_name, city) * * manages (employee_name, manager_name) * ************************************************* Figure CompanyDB. Using the course database, give an expression in SQL for each of the following queries. The expected results are indicated for each query. a. Find the names of all employees who work for First Bank Corporation. EMPLOYEE_NAME -------------------- Ferris Johnson Laikin Moira Turner b. Find the names and cities of residence of all employees who work for First Bank Corporation. EMPLOYEE_NAME CITY -------------------- -------------------- Ferris Westchester Johnson Palo Alto Laikin Culver City
  • 2. Moira Kentwood Turner Palo Alto c. Find the names, street address, and cities of residence of all employees who work for First Bank Corporation and earn more than $10,000. EMPLOYEE_NAME STREET CITY -------------------- ------------------------------ -------------------- Ferris Loyola Westchester Johnson Alma Palo Alto Laikin Berryman Culver City Moira Nancy Kentwood Turner Alma Palo Alto d. Find all employees in the database who live in the same cities as the companies for which they work. EMPLOYEE_NAME -------------------- August Brooks Curry Hayes Jones Smith e. Find all employees in the database who live in the same cities and on the same streets as do their managers. EMPLOYEE_NAME -------------------- Curry Lindsay
  • 3. Turner Williams f. Find all employees in the database who do not work for First Bank Corporation EMPLOYEE_NAME -------------------- Adams August Brooks Curry Glenn Green Hayes Jones Lindsay Schmidt Smith Williams Young g. Find all employees in the database who earn more than every employee of Small Bank Corporation. EMPLOYEE_NAME SALARY -------------------- --------- August 150000.00 Schmidt 120000.00 h. Assume that the companies may be located in several cities. Find all companies located in every city in which Small Bank Corporation is located
  • 4. COMPANY_NAME ------------------------------ Small Bank Corporation i. Find all employees who earn more than the average salary of all employees of their company. EMPLOYEE_NAME -------------------- Adams August Brooks Ferris Glenn Green Johnson Laikin j. Find the company that has the most employees. Show the company name and number of employees. COMPANY_NAME COUNT(DISTINCT employee_name) ------------------------------ ----------------------------- First Bank Corporation 5 k. Find the company that has the smallest payroll. COMPANY_NAME ------------------------------ Cathedral Software l. Find those companies whose employees earn a higher salary, on average, than the average salary at First Bank Corporation. COMPANY_NAME ------------------------------
  • 5. IBM Integrated Data Systems Multnomah Software Small Bank Corporation Sneakers saugust-CompanyDB-DROP.sql DROP TABLE IF EXISTS works ; DROP TABLE IF EXISTS works2 ; DROP TABLE IF EXISTS manages ; DROP TABLE IF EXISTS manages2 ; DROP TABLE IF EXISTS company ; DROP TABLE IF EXISTS company2 ; DROP TABLE IF EXISTS employee ; DROP TABLE IF EXISTS employee2 ; __MACOSX/._saugust-CompanyDB-DROP.sql
  • 6. saugust-CompanyDB.sql SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SE[email protected]@CHARACTER_SE T_RESULTS */; /*!40101 SET @[email protected]@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -------------------------------------------------------- -- -- Table structure for table `company` -- CREATE TABLE IF NOT EXISTS `company` ( `company_name` varchar(30) NOT NULL DEFAULT '', `city` varchar(20) DEFAULT NULL, PRIMARY KEY (`company_name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `company` --
  • 7. INSERT INTO `company` (`company_name`, `city`) VALUES ('Cathedral Software', 'San Francisco'), ('First Bank Corporation', 'Brooklyn'), ('IBM', 'San Jose'), ('Integrated Data Systems', 'Westchester'), ('Multnomah Software', 'Westchester'), ('Small Bank Corporation', 'Palo Alto'), ('Sneakers', 'Chicago'); -- -------------------------------------------------------- -- -- Table structure for table `company2` -- CREATE TABLE IF NOT EXISTS `company2` ( `company_name` varchar(30) NOT NULL DEFAULT '', `city` varchar(20) NOT NULL DEFAULT '', PRIMARY KEY (`company_name`,`city`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `company2` -- INSERT INTO `company2` (`company_name`, `city`) VALUES ('August Software', 'Westchester'), ('Cathedral Software', 'Palo Alto'), ('Cathedral Software', 'San Francisco'), ('Cathedral Software', 'Santa Clara'), ('First Bank Corporation', 'Brighton'), ('First Bank Corporation', 'Brooklyn'), ('IBM', 'San Jose'), ('IBM', 'Yorktown Heights'), ('Integrated Data Systems', 'Westchester'),
  • 8. ('Small Bank Corporation', 'Palo Alto'), ('Small Bank Corporation', 'Santa Clara'); -- -------------------------------------------------------- -- -- Table structure for table `employee` -- CREATE TABLE IF NOT EXISTS `employee` ( `employee_name` varchar(20) NOT NULL DEFAULT '', `street` varchar(30) DEFAULT NULL, `city` varchar(20) DEFAULT NULL, PRIMARY KEY (`employee_name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `employee` -- INSERT INTO `employee` (`employee_name`, `street`, `city`) VALUES ('Adams', 'Nassau', 'Princeton'), ('August', 'Riggs', 'Westchester'), ('Brooks', 'North', 'San Jose'), ('Curry', 'North', 'San Jose'), ('Ferris', 'Loyola', 'Westchester'), ('Glenn', 'Park', 'Pittsfield'), ('Green', 'Walnut', 'Stamford'), ('Hayes', 'Main', 'San Francisco'), ('Johnson', 'Alma', 'Palo Alto'), ('Jones', 'Main', 'San Jose'), ('Laikin', 'Berryman', 'Culver City'), ('Lindsay', 'Park', 'Pittsfield'), ('Moira', 'Nancy', 'Kentwood'), ('Schmidt', 'Nardian', 'Los Angeles'),
  • 9. ('Smith', 'North', 'Westchester'), ('Turner', 'Alma', 'Palo Alto'), ('Williams', 'Nassau', 'Princeton'), ('Young', 'Loyola', 'Westchester'); -- -------------------------------------------------------- -- -- Table structure for table `employee2` -- CREATE TABLE IF NOT EXISTS `employee2` ( `employee_name` varchar(20) NOT NULL DEFAULT '', `street` varchar(30) DEFAULT NULL, `city` varchar(20) DEFAULT NULL, PRIMARY KEY (`employee_name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `employee2` -- INSERT INTO `employee2` (`employee_name`, `street`, `city`) VALUES ('Adams', 'Nassau', 'Princeton'), ('August', 'Riggs', 'Westchester'), ('Brooks', 'North', 'San Jose'), ('Cox', 'National', 'Rockville'), ('Curry', 'North', 'San Jose'), ('Draskovic', 'Faraday', 'Reston'), ('Ferris', 'Loyola', 'Westchester'), ('Glenn', 'Park', 'Pittsfield'), ('Green', 'Walnut', 'Stamford'), ('Hayes', 'Main', 'San Francisco'), ('Johnson', 'Alma', 'Palo Alto'), ('Jones', 'Main', 'San Jose'),
  • 10. ('Kent', '80th', 'Culver City'), ('Laikin', 'Berryman', 'Culver City'), ('Lindsay', 'Park', 'Pittsfield'), ('Malcolm', 'Paddock', 'Jurassic Part'), ('Moira', 'Nancy', 'Kentwood'), ('Price', 'Library', 'Reston'), ('Ryan', 'Pennsylvania', 'District of Columbia'), ('Schmidt', 'Nardian', 'Los Angeles'), ('Smith', 'North', 'Westchester'), ('Turner', 'Alma', 'Palo Alto'), ('Williams', 'Nassau', 'Princeton'), ('Woody', 'Emerson', 'Culver City'), ('Young', 'Loyola', 'Westchester'); -- -------------------------------------------------------- -- -- Table structure for table `manages` -- CREATE TABLE IF NOT EXISTS `manages` ( `employee_name` varchar(20) NOT NULL DEFAULT '', `manager_name` varchar(20) DEFAULT NULL, PRIMARY KEY (`employee_name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Add foreign key constraint -- ALTER TABLE manages ADD CONSTRAINT manages_employee_name_FK FOREIGN KEY (employee_name) REFERENCES employee(employee_name) ;
  • 11. ALTER TABLE manages ADD CONSTRAINT manages_manager_name_FK FOREIGN KEY (manager_name) REFERENCES employee(employee_name) ; -- -- Dumping data for table `manages` -- INSERT INTO `manages` (`employee_name`, `manager_name`) VALUES ('Adams', 'Ferris'), ('Curry', 'Brooks'), ('Glenn', 'Green'), ('Johnson', 'Moira'), ('Jones', 'Brooks'), ('Laikin', 'Adams'), ('Lindsay', 'Glenn'), ('Smith', 'August'), ('Turner', 'Johnson'), ('Williams', 'Adams'), ('Young', 'Glenn'); -- -------------------------------------------------------- -- -- Table structure for table `works` -- CREATE TABLE IF NOT EXISTS `works` ( `employee_name` varchar(20) NOT NULL DEFAULT '', `company_name` varchar(30) DEFAULT NULL, `salary` decimal(8,2) DEFAULT NULL, PRIMARY KEY (`employee_name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  • 12. -- -- Add foreign key constraint -- ALTER TABLE works ADD CONSTRAINT works_employee_name_FK FOREIGN KEY (employee_name) REFERENCES employee(employee_name) ; ALTER TABLE works ADD CONSTRAINT works_company_name_FK FOREIGN KEY (company_name) REFERENCES company(company_name) ; -- -- Dumping data for table `works` -- INSERT INTO `works` (`employee_name`, `company_name`, `salary`) VALUES ('Adams', 'Sneakers', 90000.00), ('August', 'Multnomah Software', 150000.00), ('Brooks', 'IBM', 85000.00), ('Curry', 'IBM', 70000.00), ('Ferris', 'First Bank Corporation', 100000.00), ('Glenn', 'Small Bank Corporation', 102000.00), ('Green', 'Small Bank Corporation', 110000.00), ('Hayes', 'Cathedral Software', 60000.00), ('Johnson', 'First Bank Corporation', 99000.00), ('Jones', 'IBM', 75000.00), ('Laikin', 'First Bank Corporation', 91000.00), ('Lindsay', 'Small Bank Corporation', 60000.00),
  • 13. ('Moira', 'First Bank Corporation', 17000.00), ('Schmidt', 'Integrated Data Systems', 120000.00), ('Smith', 'Multnomah Software', 50000.00), ('Turner', 'First Bank Corporation', 30000.00), ('Williams', 'Sneakers', 67000.00), ('Young', 'Small Bank Corporation', 57000.00); -- -------------------------------------------------------- -- -- Table structure for table `works2` -- CREATE TABLE IF NOT EXISTS `works2` ( `employee_name` varchar(20) NOT NULL DEFAULT '', `company_name` varchar(30) NOT NULL DEFAULT '', `city` varchar(20) NOT NULL DEFAULT '', `salary` decimal(8,2) DEFAULT NULL, PRIMARY KEY (`employee_name`,`company_name`,`city`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Add foreign key constraint -- ALTER TABLE works2 ADD CONSTRAINT works2_employee_name_FK FOREIGN KEY (employee_name) REFERENCES employee(employee_name) ; ALTER TABLE works2 ADD CONSTRAINT works2_company_name_FK FOREIGN KEY (company_name) REFERENCES company(company_name) ;
  • 14. -- -- Dumping data for table `works2` -- INSERT INTO `works2` (`employee_name`, `company_name`, `city`, `salary`) VALUES ('Adams', 'Sneakers', 'Chicago', 90000.00), ('August', 'Multnomah Software', 'Westchester', 150000.00), ('Brooks', 'IBM', 'San Jose', 85000.00), ('Curry', 'IBM', 'San Jose', 70000.00), ('Ferris', 'First Bank Corporation', 'Brooklyn', 100000.00), ('Glenn', 'Small Bank Corporation', 'Palo Alto', 102000.00), ('Green', 'Small Bank Corporation', 'Palo Alto', 110000.00), ('Hayes', 'Cathedral Software', 'San Francisco', 60000.00), ('Johnson', 'First Bank Corporation', 'Brooklyn', 99000.00), ('Jones', 'IBM', 'San Jose', 75000.00), ('Laikin', 'First Bank Corporation', 'Brooklyn', 91000.00), ('Lindsay', 'Small Bank Corporation', 'Palo Alto', 60000.00), ('Moira', 'First Bank Corporation', 'Brooklyn', 17000.00), ('Moira', 'Multnomah Software', 'Westchester', 67000.00), ('Schmidt', 'Integrated Data Systems', 'Westchester', 120000.00), ('Smith', 'Multnomah Software', 'Westchester', 50000.00), ('Turner', 'First Bank Corporation', 'Brooklyn', 30000.00), ('Williams', 'Sneakers', 'Chicago', 67000.00), ('Young', 'Small Bank Corporation', 'Palo Alto', 57000.00); /*!40101 SET [email protected]_CHARACTER_SET_CLIENT */; /*!40101 SET [email protected]_CHARACTER_SET_RESULTS */; /*!40101 SET [email protected]_COLLATION_CONNECTION */;