SlideShare a Scribd company logo
1 of 15
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-sqlkumarsadasivuni
 
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 2Charles Givre
 
Intro to tsql unit 2
Intro to tsql   unit 2Intro to tsql   unit 2
Intro to tsql unit 2Syed Asrarali
 
Intro To TSQL - Unit 2
Intro To TSQL - Unit 2Intro To TSQL - Unit 2
Intro To TSQL - Unit 2iccma
 
Cassandra model
Cassandra modelCassandra model
Cassandra modelzqhxuyuan
 
Advanced MySQL Query Tuning
Advanced MySQL Query TuningAdvanced MySQL Query Tuning
Advanced MySQL Query TuningAlexander Rubin
 
Chris Mc Glothen Sql Portfolio
Chris Mc Glothen Sql PortfolioChris Mc Glothen Sql Portfolio
Chris Mc Glothen Sql Portfolioclmcglothen
 
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,.docxfaithxdunce63732
 
第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.phpssuserfa5723
 
MySQL Built-In Functions
MySQL Built-In FunctionsMySQL Built-In Functions
MySQL Built-In FunctionsSHC
 
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 optimizationKaren Morton
 
set FOREIGN_KEY_CHECKS=false;-- --------------------------.docx
set FOREIGN_KEY_CHECKS=false;-- --------------------------.docxset FOREIGN_KEY_CHECKS=false;-- --------------------------.docx
set FOREIGN_KEY_CHECKS=false;-- --------------------------.docxklinda1
 
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 platformMarko Švaljek
 
Er diagram for library database
Er diagram for library databaseEr diagram for library database
Er diagram for library databaseSreedhar 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 systemvikram mahendra
 
3. R- list and data frame
3. R- list and data frame3. R- list and data frame
3. R- list and data framekrishna 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.docxmonicafrancis71118
 
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.docxmonicafrancis71118
 
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 .docxmonicafrancis71118
 
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.docxmonicafrancis71118
 
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.docxmonicafrancis71118
 
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 .docxmonicafrancis71118
 
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.docxmonicafrancis71118
 
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.docxmonicafrancis71118
 
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.docxmonicafrancis71118
 
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.docxmonicafrancis71118
 
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. .docxmonicafrancis71118
 
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.docxmonicafrancis71118
 
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.docxmonicafrancis71118
 
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.docxmonicafrancis71118
 
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.docxmonicafrancis71118
 
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 .docxmonicafrancis71118
 
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.docxmonicafrancis71118
 
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.docxmonicafrancis71118
 
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 .docxmonicafrancis71118
 
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 .docxmonicafrancis71118
 

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

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 

Recently uploaded (20)

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 

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 */;