Question

In: Computer Science

A) DDL For Company DB Schema, Answer the below questions: Emp (Empno, Ename, Job, Hiredate, Sal,...

A) DDL

For Company DB Schema, Answer the below questions:

Emp (Empno, Ename, Job, Hiredate, Sal, Comm, Deptno)

Dept (Deptno, Dname, loc)

1. Retrieve the data of all employees.

2. Retrieve the data of all Salemanemployees.

3. Retrieve the name and Salary of all employees.

4. Retrieve the name and salary of Salemanemployees.

5. Retrieve the name and salary of all employees with Salary more than 2000.

6. Retrieve the Name and Salary of all employees who work in department no 20.

7. Retrieve the name and Job of all employees with Salary more than 2000 and hiredate after 01-01-1981.

8. Retrieve the Job and Salary of all employees with Name = FORD or MARTIN.

9. Retrieve the Name and Number of all Departments.

10. Retrieve the Employee Name and Department number for all employees.

11. Retrieve the Employee Name and Department name for all employees.

12. Retrieve the Employee Name and who works in Department name = RESEARCH.

13. Retrieve the Employee names who workin one of these Departments: RESEARCHand SALES.

14. Retrieve the Employee name who works in department located in NEW YORK.

please write in computer word not on paper

Solutions

Expert Solution

1. Retrieve the data of all employees.
         select *from emp

2. Retrieve the data of all salesman employees.

      select *from emp where job='salesman'

3. Retrieve the name and salary of all employees

    select ename, sal from emp

4. Retrieve the name and salary of salesman employees
    select ename, sal from emp where job='salesman'

5. Retrieve the name and salary of all employees with salary more than 2000

    select ename, sal from emp where sal>2000

6. Retrieve the name and salary of all employees who work in dept no 20

    select ename, sal from emp where deptno=20

7. Retrieve the name and job of all employees with salary more than 2000 and hire date after 01-01-1991

    select ename, job from emp where sal > 2000 AND hiredate > '01-jan-1991'

8. Retrieve the Job and Salary of all employees with name= FORD or MARTIN
    select job,sal from emp where ename='FORD' OR ename= 'MARTIN'

9. Retrieve the name and number of all departments

    select dbname,deptno from dept

10. Retrieve the employee name and dept no of all employees

    select ename,deptno from emp

11. Retrieve the employee name and dept name of all employees

    select e.ename,d.dbname from emp e,dept d where e.deptno=d.deptno

12. Retrieve the employee name who works in department name=RESEARCH

    select ename from emp where deptno in (select deptno from dept where dbname='RESEARCH')

13. Retrieve the employee name who works in department name=RESEARCH and SALES

select ename from emp where deptno in (select deptno from dept where dbname='RESEARCH' OR dbname='SALES')

14. Retrieve the employee name who works in department located in NEW YORK

    select ename from emp where deptno in (select deptno from dept where loc='NEW YORK')


Related Solutions

B) DML and SQL Query For this DB Schema, answer the below questions: Employee (Fname, Minit,...
B) DML and SQL Query For this DB Schema, answer the below questions: Employee (Fname, Minit, Lname, Ssn, Bdate, Address, Sex, Salary, Super_ssn, Dno) Department (Dname, Dnumber, Mgr_ssn, Mgr_start_date) 5. Delete from Employee table, those who have First name: James. 6. Delete from Employee table, those who have Salary more than 4000. 7. What happens if you try to delete one department? 8. Retrieve the data of all employee. 9. Retrieve the data of all male employee. 10. Retrieve the...
Given the following relational schema, write queries in SQL to answer the English questions. There is...
Given the following relational schema, write queries in SQL to answer the English questions. There is a shipment database on the MySQL server. You can also use the DDL for MySQL. You must only submit the SQL for your answers but you can include the query output as well to help the TA with marking. Customer(cid: integer, cname: string, address: string, city: string, state: string) Product(pid: integer, pname: string, price: currency, inventory: integer) Shipment(sid: integer, cid: integer, shipdate: Date/Time) ShippedProduct(sid:...
Given the following relational schema, write queries in SQL to answer the English questions. There is...
Given the following relational schema, write queries in SQL to answer the English questions. There is a shipment database on the MySQL server. You can also use the DDL for MySQL. You must only submit the SQL for your answers but you can include the query output as well to help the TA with marking. Customer(cid: integer, cname: string, address: string, city: string, state: string) Product(pid: integer, pname: string, price: currency, inventory: integer) Shipment(sid: integer, cid: integer, shipdate: Date/Time) ShippedProduct(sid:...
The schema for the Academics database is as follows. Understanding this schema is necessary to answer...
The schema for the Academics database is as follows. Understanding this schema is necessary to answer the questions in Part B. DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode) ACADEMIC(acnum, deptnum*, famname, givename, initials, title) PAPER(panum, title) AUTHOR(panum*, acnum*) FIELD(fieldnum, id, title) INTEREST(fieldnum*, acnum*, descrip) The semantics of most attributes are self-explanatory. For each relation, the primary key is underlined and any foreign keys are denoted by an asterisk (*). Some additional information for relations is given below: DEPARTMENT: Each academic department...
For the given database schema. Answer the following questions. Company Database customer(cust_id, name, address) product(product_id, product_name,...
For the given database schema. Answer the following questions. Company Database customer(cust_id, name, address) product(product_id, product_name, price, quantity) transaction(trans_id, cust_id, time_date) product_trans(product_id, trans_id) Identify the primary keys and foreign keys for the relations and specify at least two different types of integrity constraints that would be applicable for different relations given.
Please answer the questions below: 1. Sam quit a $30,000-a-year job with a local heating and...
Please answer the questions below: 1. Sam quit a $30,000-a-year job with a local heating and air conditioning firm to go into business for himself. After his first year in business, his accountant showed him an income statement that indicated Sam’s firm had a profit of $40,000. During this year Sam had drawn a salary of $20,000. a) What was Sam’s accounting profit, his entrepreneurial profit, and his opportunity cost? b) Explain the difference between accounting and entrepreneurial profit. 2....
Lesson 3.3 DB - Wages and Supply and Demand Please answer both questions to receive full...
Lesson 3.3 DB - Wages and Supply and Demand Please answer both questions to receive full credit for this assignment.  Use your Unit 3 Notes Guide to help you craft your answers.  Be sure to remember to use economic evidence from the lesson to support your opinion. 1. How do we decide how much each person in society should be paid? Why do some jobs receive high wages while others do not? Do wages reflect what types of jobs our society values?...
Lesson 3.3 DB - Wages and Supply and Demand Please answer both questions to receive full...
Lesson 3.3 DB - Wages and Supply and Demand Please answer both questions to receive full credit for this assignment.   Use your Unit 3 Notes Guide to help you craft your answers.   Be sure to remember to use economic evidence from the lesson to support your opinion. 1. How do we decide how much each person in society should be paid? Why do some jobs receive high wages while others do not? Do wages reflect what types of jobs our...
Read the questions below and answer as if you are the CEO of the company: When...
Read the questions below and answer as if you are the CEO of the company: When a person doesn’t work all the hours they are supposed to during the day, are they defrauding the company? Is allowing a person to work overtime if they don't need to defrauding the company? Why must I learn to balance the cash account when I put the money in the bank to protect it? Do I have a legal obligation to give cash back...
[Q.4] Answer the following questions You are invited as a database architect to develop database schema...
[Q.4] Answer the following questions You are invited as a database architect to develop database schema for maintaining patient information for the NYU medical group (make necessary assumptions for the data requirements if needed). Each physician in the Lehman medical group is uniquely identified by physicianID o Each physician must have first name, and last name, and phone number Each patient is identified by patientID o Each patient must have first name, and last name, phone number, and insurance card...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT