Sunteți pe pagina 1din 3

SQl Assignment

What is SQL and where does it come from?


What are the difference between DDL, DML and DCL commands?
How does one escape characters when building SQL queries?
How does one eliminate duplicate rows from a table?
How does one generate primary key values for a table?
How does one get the time difference between two date columns?
How does one add a day/hour/minute/second to a date value?
How does one count different data values in a column?
How does one count/sum RANGES of data values in a column?
Can one retrieve only the Nth row from a table?
Can one retrieve only rows X to Y from a table?
How does one select EVERY Nth row from a table?
How does one select the TOP N rows from a table?
How does one code a tree-structured query?
How does one code a matrix report in SQL?
How does one implement IF-THEN-ELSE in a select statement?
How can one dump/ examine the exact content of a database column?
Can one drop a column from a table?
Can one rename a column in a table?
How does one find the next value of a sequence?

Queries:

Dept

Deptno Dname Loc


10 ACCOUNT Mumbai
20 ADMIN Banglore
30 IT Chennai

Emp

Empno Ename Job Salary Comm Hiredate Deptno Experience


11999 SCOTT MANAGER 45000 0 12-Jan-00 10 20
12000 BLACK ACCOUNTANT 20000 1500 13-Feb-00 10 13
12001 SMITH ASS ACCOUNTANT 15000 1200 24-Jan-00 10 7
12002 KING OPERATOR 8000 1200 15-Mar-00 20 1
12003 RED SN OPERATOR 10000 0 16-Apr-00 20 2
12004 KAT SOFTWARE ENGINEER 35000 0 17-Nov-00 30 3
ASS SOFTARE 2
12005 MICHLE ENGINEER 25000 0 18-Jan-00 30
DATA ENTRY 1
12006 MAKD OPERATOR 9000 0 1-Jan-00 20
SQL
Level –1

1)Write a query to list all the employees who are working as clerk
2) Write a query to list the employees who are working as clerks or
managers with the minimum salary of 4000
3) Write a query to get the current date
4) Write a query o list the employees who are having experience more
than 4 years
5) Write a query to list the employees who hired in the last seven days
6) Write a query to list the employees whose salaries are within the
range of 5000 and 10000
7) Write a query to list the employees who have joined in the month of
March’99
8) Write a query to list the employees whose salaries are not within
the range of 10000 and 13000
9) Write a query who are getting 1000, 2000, 3000
10) Query to list all employees except who are joined on 11- Sep-2001,
31-Mar-2002
11) To list all the employees whose names are having ‘O’ as second
character

12) To list all the employees whose names are having ‘R’ as last
character
13) To list all the employees whose names are having just 5 characters
as length.
14) To list all the employees whose names are starting with ‘R’ and
ending with ‘O’

Write The Following Queries For The Above Tables:

A) Display the all records of the employee’s table.


B) Display the employee name, salary, and commission of those
Employee’s salaries Higher than 1500.
C) Display the employee name, salary, job and commission of
those
Employee’s commission is null.
D) Display the employee’s name, employee number, salary, job
and
Commission Of that Employee’s salary higher than Scott’s
salary.
E) Write inner-joining Query.
F) Write the Outer-joining Query.
G) Display Department name, location and employee name of
those
Employee’s who work in Account Department.
H) Display name, job, salary of those employees who is
salary’s 1rd
highest
I) Display name, job, salary of those employees who is
salary’s 1rd lowest
Salary among all employees’ salaries.
J) Display name, job,salary of those employees who work Mr.KAT
Employee.
K) Display name,job,salary of those employee who is not work
with Mr. KAT
L) Display the Department name, employee name and salary from
emplyee
tables.
M) Show the sum of salaries of all department but sum of
salary must be
Greater than 8500.
N) Write the query display the Department names and their
employee’s
names.
O) Display the all employees name, job and salary they work in
department 10.
P) Display the all records their salaries must be higher than
Clerk
Salaries.
Q) Show the records of the all employees their last letter’ H
in the
name.
R) Sum salaries of the all employees according to the job.
S) Increase the 10% of Salary who work in Account Department.
T) Delete the all employee who work in the Scott Department.
U) Assign the scott salary who work in the department 10.
V) Delete the all records their salaries higher than 1500;
W) Display the highest salary and his name from employee
table.
X) splay the Lowest salary and his name from employee table.
Y) Display the highest salary from Account Department.
Z) Display the lowest salary from Account Department.
AA) Assign the highest salary to the scott employee.
AB) Assign the lowest salary the the scott employee.
AC) Assign the 10 % of salary to every employee of commission.
AD) Display the all records their commission is null.

S-ar putea să vă placă și