0% found this document useful (0 votes)
27 views4 pages

Sample Table For Practice

Ye

Uploaded by

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

Sample Table For Practice

Ye

Uploaded by

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

1)

Table Worker Table Dept


WNO NAME DOJ DOB GENDER DCODE
DCODE DEPARTMENT CITY
1001 George 2013-09-02 1991-09-01 Male D01
D01 Media Delhi
1002 Rama Sen 2012-12-11 1990-12-15 Female D03
D02 Marketing Delhi
1003 Mohitesh 2013-02-03 1987-09-04 Male D05
D03 Infrastructure Mumbai
1007 Anil Jha 2014-01-17 1984-10-19 Male D04
D05 Finance Kolkata
1004 Manila Sahai 2012-12-09 1986-11-14 Female D01
D06 Human Resource Mumbai
1005 R Sahay 2013-11-18 1987-03-31 Male D02
1006 Jaya Priya 2014-06-09 1985-06-23 Female D05

i) To display Wno, Name, Gender from table Worker in descending order of Wno.
ii) To display the name of all Female workers from the table Workers.
iii) To display the Wno and name of those workers from the table worker who are born between ‘1987-01-01’ and
‘1991-12-01’.
iv) To count and display MALE workers who have joined after ‘1986-12-01’.
v) SELECT COUNT (*), DCODE FROM WORKER GROUP BY DCODE HAVING COUNT > 1;
vi) SELECT DISTINCT DEPARTMENT FROM DEPT;
vii) SELECT NAME, DEPARTMENT, CITY FROM WORKER W, DEPT D WHERE W. DCODE = D. DCODE AND WNO < 1003;
viii) SELECT MAX(DOJ), MIN(DOB) FROM WORKER;

2)

Table Employee Table Salary


Eid Name Depid Qualification Gender Eid Basic DA HRA Bonus
1 Deepali Gupta 101 MCA F 1 6000 2000 2300 200
2 Rajat Tyagi 101 BCA M 2 2000 300 300 30
3 Hari Mohan 102 BA M 3 1000 300 300 40
4 Harry 102 MA M 4 1500 390 490 30
5 Sumit Mittal 103 B.Tech M 5 8000 900 900 80
6 Jyoti 101 M.Tech F 6 10000 300 490 89

i) To display the frequency of employee department wise.


ii) To list of those employees only whose name start with ‘H’.
iii) To add a new column in salary table. The column name is Total_sal.
iv) To store the corresponding values in the table Total_sal.
v) SELECT MAX(Basic) FROM SALARY WHERE Bonus > 40;
vi) SELECT COUNT (*) FROM Employee GROUP BY Gender;
vii) SELECT DISTINCT Depid from Employee;
viii) SELECT Name, Basic, Total_sal FROM Employee E, Salary S WHERE E. Eid=S.Eid;
3)

Table MobileMaster Table MobileStock


M_ID M_Compony M_Name M_Price M_MF_Date S_ID M_ID M_Qty M_Supplier
MB001 Samsung Galaxy 4500 2013/02/12 S001 MB004 450 New Vision
MB003 Nokia N1100 2250 2011/04/15 S002 MB003 250 Praveen Gallery
MB004 Micromax Unite3 4500 2016/10/17 S003 MB001 300 Classic Mobile Store
MB005 Sony XperiaM 7500 2017/11/20
MB006 Oppo SelfieEx 8500 2010/08/21

i) Display the mobile company, mobile Name and price in descending order of their manufacturing date
ii) List the details of mobile phones whose names start with ‘S’.
iii) Display the names of mobile suppliers and quantity of all mobiles except “MB003”
iv) Display the names of mobiles companies having price between 3000 – 5000.
v) SELECT M_ID, SUM(M_Qty) FROM MobileStock GROUP BY M_ID;
vi) SELECT MAX(M_MF_Date), MIN(M_MF_Date) FROM MobileMaster;
vii) SELECT M1.M_ID, M1.Name, M2_Qty, M2.M_Supplier FROM MobileMaster M1, MobileStock M2 WHERE
M1.M_ID=M2.M_ID AND M2_Qty>=300;
viii) SELECT AVG(M_Price) FROM MobileMaster;

4)

Table : Faculty Table : Courses


F_ID Fname Lname Hire_Date Salary C_ID F_ID Cname Fees
102 Amit Mishra 12/10/1998 12000 C21 102 Grid Computing 40000
103 Nitin Vyas 24/12/1994 8000 C22 106 System Design 16000
104 Rakshit Soni 18/05/2001 14000 C23 104 Computer Security 8000
105 Rashmi Malhotra 11/09/2004 11000 C24 106 Human Biology 15000
106 Sulekha Srivastava 05/06/2006 1000 C25 102 Computer Network 20000
C26 105 Visual Basic 6000

i) Display the details of the faculty members whose salary are greater than 12000.
ii) Display the details of courses that cost between 15000 – 50000 (including both values).
iii) Increase the fee for the “System Designing” course by 500.
iv) Display details of those course which are taught by “Sulekha” in descending order of course.
v) SELECT COUNT (DISTINCT F_ID) FROM courses;
vi) SELECT MIN (Salary) FROM Faculty, Courses WHERE Courses.F_ID = Faculty.F_ID;
vii) SELECT SUM (Fees) FROM courses WHERE F_ID=102;
viii) SELECT AVG(Fees) FROM Courses:
5)

Table WATCHES Table SALE


WatchId Watch_Name Price Type Qty_Store WatchId Qty_Sold Quarter
W001 High Time 10000 Unisex 100 W001 10 1
W002 Life Time 15000 Ladies 150 W003 5 1
W003 Wave 20000 Gents 200 W002 20 2
W004 High Fasshion 7000 Unisex 250 W003 10 2
W005 Golden Time 25000 Gents 100 W001 15 3
W002 20 3
W005 10 3
W003 15 4

i) Display all the details of those watches whose name with Time.
ii) Display the name and price of those watches, which have price range between 5000 – 15000.
iii) Display the total quantity in store of ‘Unisex’ type watches.
iv) Display the watch names and the quantity sold in the first quarter.
v) SELECT MAX (price), MIN (qty_store) FROM watches;
vi) SELECT quarter, SUM (qty_sold) FROM sale GROUP BY quarter;
vii) SELECT Watch_Name , price, type FROM Watches W, Sales S WHERE W.watchId = S.watchId
viii) SELECT watch_Name, qty_store, SUM (qty_sold), qty_store- SUM (qty_sold) ‘ Stock‘ FROM watches W , sales S
WHERE W.watchId = S.watchId GROUP BY S.watchId;

6)

Table Carden Table Customer


Ccode CarName Make Colour Capacity Charges Code Cname Ccode
501 A-Star Suzuki RED 3 14 1001 Hernant Sahu 501
503 Indigo Tata SILVER 3 12 1002 Raj Lal 509
502 Innova Toyota WHITE 7 15 1003 Feroza 503
509 SX4 Suzuki SILVER 4 14 1004 Ketan Dhal 502
510 C Class Mercedes RED 4 35

i) Display the customer’s names and all corresponding names of cars hired by them.
ii) Display names of cars, make and capacity in descending order of their seating capacity.
iii) Display the highest charges at which a vehicle can be hired from Carden.
iv) Display the names of all silver-coloured cars.
v) SELECT MAX (charges), MIN (charges) FRPM carden;
vi) SELECT COUNT (DISTINCT Make) FROM carden;
vii) SELECT COUNT (carName) FROM carden;
7)

Table School Table Admin


Code Teacher Subject DOJ Periods Experience Code Gender Designation
1001 Ravi Sankar English 12/03/2000 24 10 1001 Male Vice Principal
1009 Priya Rai Physics 03/09/1998 26 12 1009 Female Coordinator
1203 Lis Anand English 09/04/2000 27 5 1203 Female Coordinator
1045 Yashraj Maths 24/08/2000 24 15 1045 Male HOD
1123 Gagan Physics 16/07/1999 28 3 1123 Male Senior Teacher
1167 Harish B Chemistry 19/10/1999 27 5 1167 Male Senior Teacher
1115 Umesh Physics 11/05/1998 22 16 1215 Male HOD

i) Show teacher name their DOJ before year 2000.


ii) Show all teacher name and their gender and subject.
iii) Show all teachers name and experience in descending order by their experience.
iv) Show name, gender, subject and designation of all female teachers.
v) SELECT designation COUNT (*) FROM admin GROUP BY designation HAVING COUNT(*) < 2;
vi) SELECT MAX(Experience) FRON School.
vii) SELECT teacher FROM School WHERE Experience > 12 ORDER BY Teacher;
viii) SELECT COUNT (*), gender FROM admin GROUP BY gender;

8)

Table Product Table Client


P_ID ProductName Manufacturer Price C_ID ClientName City P_ID
TP01 Talcum Powder LAK 40 01 Cosmetic Soap Delhi FW05
FW05 Face Wash Ponds 45 06 Total Health Mumbai BS01
BS01 Bath Soap Ponds 55 12 Live Life Delhi SH06
SH06 Shampoo Sunsilk 120 15 Pretty Women Delhi FW12
FW12 Face Wash Sunsilk 95 16 Dreams Bangalore TP01

i) To display the details of those client whose City is Delhi?


ii) To display the details of product whose price is in range of 50 to 100 (Both values included).
iii) To display ClientName, City from table client and ProductName and Price from table Product, with their
corresponding matching C_ID.
iv) To increase the price of all Product by 10.
v) Display all details of product table whose ProductName start with ‘P’ letter.
vi) Display ProductName and Price from product table in ascending order by their price.
vii) Display Product name and their clientName.
viii) Display ClientName and City ascending order by city.

You might also like