Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

From the database above construct the following queries: 1) Retrieve first name, last name, and date of birth of all male employees with salary less

image text in transcribed

From the database above construct the following queries:

1) Retrieve first name, last name, and date of birth of all male employees with salary less than 35000.

SELECT first_name, last_name, date_of_birth FROM employees WHERE gender = 'male' AND salary

2) Retrieve project numbers and project locations of all projects that belong to the Administration department.

SELECT project_number, project_location FROM projects WHERE department = 'Administration';

3) Retrieve first name, last name, and SSN of all employees who work more than 10 hours on project 10.

SELECT first_name, last_name, SSN

FROM employees

WHERE project_id = 10 AND hours_worked > 10;

4) Retrieve name, date of birth, and relationship of all male dependents of employees who work for department 5.

SELECT name, date_of_birth, relationship FROM dependents WHERE gender = 'male' AND employee_id IN (SELECT employee_id FROM employees WHERE department_id = 5);

5) Retrieve first name, last name, date of birth, and salary of employees who manage departments with projects located in Houston.

SELECT first_name, last_name, date_of_birth, salary FROM employees WHERE department_id IN (SELECT department_id FROM departments WHERE project_location = 'Houston' AND manager_id = employee_id);

PROBLEM

The queries have been constructed and I have all the tables in mqSQL database, but each time I run these queries I get the error "Error Code 1146. Table 'company.employees' doesen't exist". Please help!.

For example this query works:

/*Query 2. For every project located in Stafford, list project number, controlling department number, and department managers last name, address, and birth date.*/ SELECT p.pnumber, p.dnum, e.lname, e.address, e.bdate FROM project p, department d, employee e WHERE p.dnum = d.dnumber AND d.mgr_ssn = e.ssn AND p.plocation = 'Stafford';

image text in transcribed

Denartment Dependent Dept_locations Employee Works_on \begin{tabular}{|l|l|l|l|l|l} & pnumber & dnum & Iname & address & bdate \\ \hline 10 & 4 & Wallace & 291 Berry, Bellaire, TX & 19110620 \\ & 30 & 4 & Wallace & 291 Berry, Bellaire, TX & 19110620 \end{tabular}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

How would we like to see ourselves?

Answered: 1 week ago

Question

How can we visually describe our goals?

Answered: 1 week ago

Question

What metaphors might describe how we work together?

Answered: 1 week ago