Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

( SINGLE TABLE QUERIES) 1.Find all information on employees 2.Find the first and

ID: 3745515 • Letter: #

Question

( SINGLE TABLE QUERIES)

1.Find all information on employees

2.Find the first and last names of employees

3.Find unique titles in the employee database

4.Find the employee number, start date and monthly salary of each employee

5.Find the employee number of all employees who make between $60000 and $71000 (both inclusive)

6.Find all information about employees whose last name or first name is Demeyer

7.Find employee numbers, start and end date of all employees who are Senior Engineers, Assistant Engineers, Engineers, or Technique Leaders

–Use the IN statement

8.Find employee numbers, start and end date of all employees whose name is not Facello, Zielinski, Haddadi, Berztiss or Demeyer

(PATTERN MATCHING)

•Find all employees who have the letters ‘lin’ in their last name

•Find salaries of employees by ascending order, and descending order of start date

Explanation / Answer

1). SELECT * FROM employees;

2). SELECT first_name, last_name FROM employees ;

3). This query can be written in two ways:

or

4). SELECT emp_no, from_date, salary FROM salaries;

5). SELECT emp_no FROM salaries WHERE salary BETWEEN $60000 and $71000;

6). SELECT employees. *, titles. *, salaries. *, dept_emp. *, departments. * FROM employees, titles, salaries, dept_emp, departments WHERE emp_no IN ( SELECT emp_no from employees WHERE first_name ='Demeyer' OR last_name='Demeyer') ;

7) SELECT emp_no, from_date, to_date, FROM titles WHERE title IN ('senior engineer', 'Assistant engineer', 'engineer', 'Technique leader') ;

8) SELECT emp_no, from_date, to_date from titles WHERE emp_no IN (SELECT emp_no FROM from employees WHERE first_name IN ('fecello' , 'zielinski' , 'Haddadi', 'Berztiss', 'Demeyer') OR last_name IN('fecello', 'zielinski', 'Haddadi', 'Berztiss', 'Demeyer') ;

Pattern Matching-