Вы находитесь на странице: 1из 1

Write a SQL command to create the following emp table.

Name Type ----------------------------------------------------EMPNO INTEGER ENAME VARCHAR(10) JOB VARCHAR(9) MGR INTEGER HIREDATE DATE SAL DECIMAL(7,2) COMM DECIMAL(7,2) DEPTNO INTEGER Insert the following data into the table. Table EMP EMPNO ENAME JOB MGR HIREDATE 7876 SMITH ANALYST 7782 12-Aug-2010 7499 ALLEN CLERK 7876 1-Apr-2005 7698 WARD MANAGER 7900 2-Jul-2001 7782 JONES PRESIDENT 21-Sep-2006 7902 MARTIN SALESMAN 7900 5-Jun-2009 7900 BLAKE ANALYST 7782 18-Jul-2009 7566 CLARK ANALYST 7782 22-May-2007 7839 SCOTT CLERK 7876 6-Mar-2005 7654 KING MANAGER 7900 19-Apr-2003 7934 TURNER CLERK 7876 30-Nov-2004 7788 ADAMS ANALYST 7782 13-Mar-2007 7369 JAMES CLERK 7876 18-Feb-2005 7844 FORD MANAGER 7900 12-Jan-2007 7521 MILLER CLERK 7876 22-Sep-2008 Table:DEPT Deptno Dname 10 HR 20 Sales 30 Production

SAL 9600 19200 15000 95700 15000 34200 29400 36000 60000 18000 13200 11400 36000 15600

COMM

20

DEPTNO 20 30 30 10 20 30 20 10 30 10 20 20 30 30

LOC New Jersey New Delhi New York

1.
2. 3. 4. 5. 6.

7. 8. 9. 10. 11.
12. 13. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24.

14.

Write a statement to show the structure of the table emp. To create a table DEPT30 to hold the all information of employees with deptno 30 Display names of all employee whose name include either of the substring TH or LL Display data for all CLERKS who earn between 1000 and 2000; Find the employees who have no manager. Display the name of the employee who earns the maximum salary. Write a SQL statement to list empno, empname, deptno for all the employees. The information should be sorted on empname; List the minimum and maximum salary for each employee. Display the name of the employee who earns the maximum salary. To display deptno, job, empname in reverse order of salary from emp. Show the average salary for all departments with more than 3 people for a job. Create a view deptno20 with empname and salary of employees for dept 20 Write a SQL statement to find out the total number of employees from emp table. Write a suitable sql statement to display employees name, salary and location of all the employees working in new york in the following format Display name and annual salary for all employee. Count no of employee working in each department. Display names of all employee whose name is at least 4 characters long; Display the current system date. display the current system time; Write a SQL query to increase the salary of each employee by 200. Display the total salary of all employees display the different job from emp table; Display the names and no of characters in each name Display ename in lower case and job in upper case

Вам также может понравиться