0% found this document useful (0 votes)
4 views6 pages

IP PracticalLIST-SQL

The document outlines a series of MySQL queries and commands aimed at creating and manipulating a database named MYORG. It includes tasks such as creating tables, inserting records, and performing various queries to extract and analyze employee data. Additionally, it covers operations like updating records, calculating salaries, and filtering employees based on specific criteria.

Uploaded by

jnvangul2024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

IP PracticalLIST-SQL

The document outlines a series of MySQL queries and commands aimed at creating and manipulating a database named MYORG. It includes tasks such as creating tables, inserting records, and performing various queries to extract and analyze employee data. Additionally, it covers operations like updating records, calculating salaries, and filtering employees based on specific criteria.

Uploaded by

jnvangul2024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Experiment No.

22
Objective: Understanding the use of MySQL queries.

1 Create and open Database named


MYORG. Ans: Create database MYORG;
Use MYORG;

2 Write a command to display the name of current


month. Ans: Select month (curdate ());

3 Write commands to display the system


date. Ans: select sysdate;

4 Write a query to find out the result of


63. Ans: select pow (6,3);

5 Write command to show the Tables in the MYORG


Database. Ans: Use MYORG;
Show tables;
DE
PT

6 Add one column State of data type VARCHAR and size 30 to table
DEPT Ans: alter table DEPT
Add(state varchar(30));

7 Create a table name EMP with following structure

Column EmpID EmpName Designatio DOJ sal com DeptI


Name n m D
Data integer Varchar Char(10) Da intege integ integ
Type (30) te r er er
Constraint Primar not null Chec Forei
y Key k> gn
Key
1000
Ans: create table emp (EmpID integer
primary key,
EmpName varchar(30) not null, Designation
char(10),
DOJ date,
Sal integer check(sal>1000), Comm integer,
DeptID integer,
Foreign key(DeptID) references DEPT(DeptID) );

EMP

EmpID EmpName Designatio DOJ Sal comm DeptID


n
8369 SMITH CLERK 18-12- 1050.0 200.00 10
1990 0
8499 ANYA SALESMAN 20-02- 1600.0 300.0 20
1991 0 0
8566 MAHADEVA MANAGER 02-04- 2985.0 NULL 30
N 1991 0
8654 MOMIN SALESMAN 28-09- 1250.0 400.00 20
1991 0
8698 BINA MANAGER 05-01- 2850.0 250.0 30
1991 0 0
8882 SHIVANSH MANAGER 09-06- 2450.0 NULL 10
1991 0
8888 SCOTT ANALYST 09-12- 3000.0 150.0 10
1992 0 0
8839 AMIR PRESIDENT 18-11- 5000.0 NULL 20
1991 0
8844 KULDEEP SALESMAN 08-04- 1500.0 0.00 30
1992 0
8 Insert the first record in table emp. Ans: insert into
emp
Values(8369,’SMITH’,’CLERK’,’18-12-1990’,800,200,10);

9 Write a query to display EmpName and Sal of employees whose salary are greater than or
to 2200

10 Write a query to display details of employees who are not getting commission.
11 Write a query to display employee name and salary of those employees who don’t have th
salary in range of 2500 to 4000.

21
12 Write a query to display the name of employee whose name contains “A” as third
alphabet in Ascending order of employee names.

13 Display the sum of salary and commission of employees as “Total Incentive” who
are getting commission

14 Show the average salary for all departments with more than 5 working
people.

15 Display the distinct designation offered by the


Organization.

16 List the count of Employees in each


department.

17 Display the names of employees who joined on or after


01/05/1991.

18 Display the employee records in order by


DOJ.

19 Display the maximum salary of employees in each


Department.

20. NOT DONE Update all the records as add ‘Mr.’ with
EmpName. Ans:
21. Display the name of Employees who is working in SALES department.
Ans:
22. NOT DONE Drop the
emp table.

23. NOT DONE Delete all the records who is working


as “CLERK”

24. Show the minimum, maximum and average salary of Managers.

25. Increase the salary of managers by 15%.

26. To display the name of those employees whose location is Delhi.

27. To display total salary of employees of sales department.


28.
29. To show details of employees who joined in the year 1991.
30. NOT DONE Delete all the records who is working as “SALESMAN” and
salary more than 1500.

31. Set the commission as 100 who are not getting any commission.

You might also like