Professional Documents
Culture Documents
C_I
D
NO
NAME
FEE
JOINYEAR
101
2
1102
1103
1049
1025
1106
1017
1108
2109
1101
Amandeep
Avisha
Ekant
Arun
Amber
Ela
Nikita
Arleena
Shakti
Kirat
30000
25000
30000
30000
40000
40000
35000
30000
35000
25000
a)
To display name, fee, gender, joinyear about the applicants, who have joined before
M
A01
2012
F
A02
2009
M
A02
2011
M
A03
2009
COURSE
M C_ID A02
2011
A01
FASHION
DESIGN
F
A05
2010
A02
NETWORKING
F
A03
2012
A03
HOTEL
F
A03 MANAGEMENT
2012
A04
EVENT
M
A04 MANAGEMENT
2011
A05
OFFICE
M
A01 MANAGEMENT
2012
2010.
b)
To display the names of applicants in descending order, who are paying fee more
than 30000.
c)
d)
To display the year and the total number of applicants joined in each YEAR from the
table APPLICANTS.
e)
To display the C_ID (i.e. Course ID) and the number of applicants registered in the
course from the APPLICANTS table.
f)
To display the applicants name with their respective courses name from the tables
APPLICANTS and COURSES.
g)
ii)
iii)
iv)
Q2. Write the SQL queries and outputs for the EMPLOYEES and EMPSALARY table:
Table: EMPLOYEES
Empi
d
Firstname Lastname Address
City
10
Ravi
Kumar
Raj nagar
GZB
105
Harry
Waltor
Gandhi nagar
GZB
152
Sam
Tones
33 Elm St.
Paris
215
Sarah
Ackerman
440 U.S. 110
Upton
244
Manila
Sengupta
24 Friends street
New Delhi
300
Robert
Samuel
9 Fifth Cross
Washington
335
Ritu
Tondon
Shastri Nagar
GZB
400
Rachel
Lee
121 Harrison St.
New York
441
Peter
Thompson
11 Red Road
Paris
Table: EMPSALARY
Empi
d
10
105
152
215
244
300
335
400
441
Salary
75000
65000
80000
75000
50000
45000
40000
32000
28000
Benefits
15000
15000
25000
12500
12000
10000
10000
7500
7500
Designation
Manager
Manager
Director
Manager
Clerk
Clerk
Clerk
Salesman
Salesman
a)
To show firstname, lastname, address and city of all employees living in Paris.
b)
To display the content of those employees whose Firstname contain t as third letter in
descending order of Firstname.
c)
To display the Firstname, Lastname and total salary of all managers from the tables
Employees and Empsalary, where total salary is calculated as Salary + Benefits
d)
To display the maximum salary among managers and clerk from the table Empsalary.
e)
f)
To display the Firstname, Lastname and respective Designation from Employee and
Empsalary table.
g)
iii)
iv)
Q3. Write the SQL queries and outputs for the CARDEN and CUSTOMER table:
Table: CARDEN
Ccod
e
501
503
502
509
510
Charges
CarName
A-Star
Indigo
Innova
SX4
C Class
Make
Suzuki
Tata
Toyota
Suzuki
Mercedes
Color
Red
Silver
White
Silver
Red
Capacity
3
3
7
4
4
14
12
15
14
35
Table: CUSTOMER
CustCo
de
1001
1002
1003
1004
Cname
Hemant Sahu
Raj Lal
Feroza Shah
Ketan Dhal
Ccode
501
509
503
502
a)
b)
To display name of car, make and capacity of cars in descending order of their sitting
capacity.
c)
To display the highest charges at which a vehicle can be hired from CARDEN.
d)
To display the customer name and the corresponding name of the cars hired by them.
e)
f)
g)
ii)
iii)
FROM Carden
GROUP BY Make;
iv)
SELECT CarName
FROM Carden
WHERE Capacity = 4;