Homework 1 problems: Based on EN6 chapter 4 / EN7 chapter 6 RULES: 0. Submit as a text file! (see also Rule 4) 1. Your queries should work even if additional data is added to the tables. 2. Every table referred to in the FROM clause should be named with a "table alias", that is e and d in: select e.lname, d.dname from employee e, department d ... 3. All answers should be in the form of a single query; do not retrieve a value with one query and then manually plug that value into a second query. Similarly, data appearing in the query should be from the exercise itself, and not from a "visual" lookup. 4. All SQL should be entered in a format that I can copy and paste directly into a command window. In particular, make sure: All "prompt" characters such as "->" have been stripped out. You use regular quotation marks, not special unicode quotation marks. Unicode-quoted ‛foo’ is not the same as 'foo'. (A sure way to convert inadvertently to unicode quotes is to paste your work into a Word document; try installing Notepad++. Or, better yet, Atom.) Postgres requires single quotation marks for strings: 'string'. There are no leading tabs or spaces 5. Use explicit join notation for joins select e.lname from EMPLOYEE E JOIN DEPARTMENT D ON E.DNO = D.DNUMBER where... ==================== #10. Specify the following queries in SQL on the COMPANY relational database schema. a. Retrieve the names of all employees in department 4 who work at least 10 hours per week on the Computerization project. (Keep in mind Rule 3, above; Computerization is currently dnumber 10, but don't use the numeric value in your query.) b. List the names of all employees who have a dependent with the same first name as themselves. (There are no such employees in the original database; you can create one with insert into dependent values ('987654321', 'Jennifer', 'F', null, 'daughter'); ) c. Find the names of all employees who are directly supervised by 'Wong'. d. Find the names of all employees who supervised a worker on project 10. (Some employees may be listed more than once.) ===================== #12. Specify the following queries in SQL on the University database schema. a. Retrieve the names of all senior students (class=4) majoring in 'CS' (computer science). b. Retrieve the names of all courses taught by Professor King in 2007 and 2008. c. For each section taught by Professor King, retrieve the course number, semester, and year. d. For each section taught by Professor King, list the course number and the students who took the section. e. Retrieve the name and transcript of each senior student (Class = 4) majoring in CS. A transcript includes course name, course number, credit hours, semester, year, and grade for each course completed by the student. The answer should look something like this: name | course_name | course_number | credit | semester | year | grade -------+---------------------------+---------------+--------+----------+------+------- Jones | Intro to Computer Science | CS1310 | 4 | Fall | 2007 | B+ Jones | Intro to Computer Science | CS1310 | 4 | Fall | 2008 | B Patel | Intro to Computer Science | CS1310 | 4 | Fall | 2008 | B- Patel | Database | CS3380 | 3 | Fall | 2008 | B Patel | Data Structures | CS3320 | 4 | Spring | 2008 | A-