You are on page 1of 5

Select query:

1. Select all data from the employee table.

Sql view:

SELECT employee.*

FROM employee;

Design view:

2. Select all data from the employee table inner join with department table.

Sql view:

SELECT employee.*, department.DEPT_NAME, department.HOD,


department.SALARY_STARTING_RANGE, department.SALARY_ENDING_RANGE

FROM employee INNER JOIN department ON employee.D_ID = department.D_ID;

Design view:

3. Select data from the employee table where employee id=5 (id can be any number)

Sql view:

SELECT employee.E_ID, employee.E_NAME, employee.ADDRESS, employee.DOB, employee.CONTACT,


employee.SALARY, employee.D_ID

FROM employee

WHERE (((employee.E_ID)=5)) OR (((employee.E_ID)=7));

Design view:

4. Select data from the employee table where employee address=”dankuni” (address can be any
where)

Sql view:
SELECT employee.E_NAME, employee.ADDRESS, employee.CONTACT, employee.SALARY,
employee.D_ID

FROM employee

WHERE (((employee.ADDRESS)="DANKUNI"));

Design view:

5. Select name, address, contact from the employee table

Sql view:

SELECT employee.E_NAME, employee.ADDRESS, employee.CONTACT

FROM employee;

Design view:

6. Select data from the employee table where employee’s name starts with p (it can be starts with
any letter)

Sql view:

SELECT employee.E_NAME, employee.ADDRESS, employee.CONTACT

FROM employee

WHERE (((employee.E_NAME) Like 'P*'));

Design view:

7. Select data from the employee table where employee’s name ends with a (it can be ends with
any letter)

Sql view:

SELECT employee.E_NAME, employee.ADDRESS, employee.CONTACT

FROM employee
WHERE (((employee.E_NAME) Like '*A'));

Design view:

8. Select data from the employee table where employee’s name content i (it can be any letter)

Sql view:

SELECT employee.E_NAME, employee.ADDRESS, employee.CONTACT

FROM employee

WHERE (((employee.E_NAME) Like '*I*'));

Design view:

9. Select data from the employee table inner join with department table where department
id=1236 (it can be any number)

Sql view:

SELECT employee.*, department.D_ID, department.DEPT_NAME, department.HOD,


department.SALARY_STARTING_RANGE, department.SALARY_ENDING_RANGE

FROM employee INNER JOIN department ON employee.D_ID = department.D_ID

WHERE (((department.D_ID)=1236));

Design view:

10. Select data from the employee table inner join with department table where salary >= 20000
(salary can be any value)

Sql view:

SELECT employee.*

FROM employee INNER JOIN department ON employee.D_ID = department.D_ID


WHERE (((department.SALARY_STARTING_RANGE)>=20000));

Design view:

11. Select data from the employee table inner join with department table where salary >= 20000
and salary<=40000 (salary can be any value)

Sql view:

SELECT employee.E_ID, employee.E_NAME, employee.SALARY, department.DEPT_NAME,


department.HOD

FROM employee INNER JOIN department ON employee.D_ID = department.D_ID

WHERE (((employee.SALARY)>=10000 And (employee.SALARY)<=20000));

Design view:

Update query:

1. Update address of employee who’s id =3

Sql view:

UPDATE employee SET employee.ADDRESS = "DANKUNI"

WHERE (((employee.E_ID)=4));

Design view:

2. Update contact number of employee who’s name=”puja”

We can’t perform this kind of update query. If we need to update any data then we must have use the
primary key criteria

Delete query:

1. Delete data from the employee table where id=2


Sql view:

DELETE employee.E_ID

FROM employee

WHERE (((employee.E_ID)=7));

Design view:

You might also like