Sunteți pe pagina 1din 3

Online Toy Store Management System

Refer the given Table structure and Data to Solve the problems.

TOY_STORE
Column Name Data Type Constraints
TOY_STORE_ID NUMBER(3) PRIMARY KEY
TOY_STORE_NAME VARCHAR2(30) NOT NULL
CITY VARCHAR2(30) Delhi, if not provided
PHONENUMBER NUMBER(10) UNIQUE AND NOT NULL
STORE_OPENING_TIME TIMESTAMP After 8 AM
STORE_CLOSING_TIME TIMESTAMP Before 10 PM

TOY_DTLS
Column Name Data Type Constraints
TOY_ID NUMBER(4) PRIMARY KEY
TOY_NAME VARCHAR2(30) NOT NULL, UNIQUE
TOY_PRICE NUMBER(7,2) > 10 , Mandatory
DISCOUNT_PERCENT NUMBER(5,2) < 90
AGEGROUP NUMBER(3) By default 5
TOY_RATING NUMBER(1) BETWEEN 1 TO 5
CATEGORY CHAR(1) Allowed I / O / B for Indoor/Outdoor and Both
TOY_PIC BLOB(16M)

TOY_REL
Column Name Data Type Constraints
TOY_ID NUMBER(4) PRIMARY KEY.FOREIGN KEY(Toy_Dtls)
TOY_STORE_ID NUMBER(3) PRIMARY KEY,FOREIGN KEY(Toy_Store)
IN_STOCK CHAR(1) By default N, allowed Y/N
AVAILABLE_QTY NUMBER(3) Default 0

TCS Internal
Following sample data should be present in your tables. You may insert more data also.

TOY_STORE_ID TOY_STORE_NAME CITY PHONENUMBER STORE_OPENING_TIME STORE_CLOSING_TIME


2014-04-01 21:42:05
1 Kid's Cave Delhi 9912312312 2014-04-01 09:10:12
2 Kid's Corner Mumbai 9912312321 2014-04-01 09:00:00 2014-04-01 20:00:00
3 Play and Grow Mumbai 9912312301 2014-04-01 09:00:00 2014-04-01 20:00:00
4 Puzzles and More Delhi 8112312301 2014-04-01 08:15:00 2014-04-01 20:00:00
5 Uncle Sam Toys Den Delhi 8112312310 2014-04-01 08:01:00 2014-04-01 20:00:00
6 Mickey Toys Delhi 8221312345 2014-04-01 09:00:00 2014-04-01 20:00:00

TOY_ID TOY_NAME TOY_PRICE DISCOUNTPERC AGEGROUP TOY_RATING CATEGORY TOY_PIC


1 Bat 500 5
2 Ball 50 5 o
3 Brainvita 250 2 10 5I
4 Scrabble 100 80 15 1I
5 Snakes and Ladders 40 0 5 2I
6 Chess 50 5 10 4I
7 Basket Ball 150 5 10 4o
8 Volley Ball 150 5 10 4o
9 Ping pong Ball 30 2 5 2b
10 Skates 450 10 3o
11 Racing _--_ cars 50 5 3I

TOY_ID TOY_STORE_ID IN_STOCK AVAILABLE_QTY


1 1N 0
2 2Y 4
3 2Y 6
1 4N 0
3 4Y 12
4 4Y 16

Insert data in TOY_REL as per your choice, minimum 15 rows should be present.

TCS Internal
Write SQL queries for following cases.
Display all numeric values to a precision of 2 decimal digits.
All comparisons should be case insensitive.

1. Display city and total number of stores present in each city.


2. Display store which is open for maximum time.
3. Display store which has been open at least two hours before current time.
4. Display stores which are either open before 9: 00 am or close after 9 :00 pm.
5. Display store names that start with 'P' and contain 'e' also some where in the name.
6. Display city with second highest number of stores.
7. Display all stores whose name is starting with 'Kid'.
8. Display all outdoor toys.
9. Display total number of toys based on their category.
10. Display stores that sell only outdoor toys.
11. Display number of stores based on category of Toys they sell.
12. Display toys from highest to lowest rating.
13. Display toys that are not given any rating.
14. Display average rating of toys.
15. Display stores that sell highest rated toys.
16. Display toys age group wise.
17. Display stores that sell toys for children of lowest age group.
18. Display average rating for toys that belong to the lowest age group.
19. Display toys with maximum discount.
20. Display calculated price after applying discount for discounted toys.
21. Display toys with lowest price or lowest discounted price.
22. Display difference between the highest priced and lowest priced toy.
23. Display stores that sell the highest priced toys
24. Display stores that sell the lowest discounted priced toys.
25. Display toys whose price is greater than average price of all toys.
26. Display the category of toys which is having its average price greater than minimum toy price.
27. Display city that has the highest count of toys for the minimum age group.
28. Display city names and the count of toy stores and toys with them city wise.
29. Display toy store name, toy name and total number of each toy available in each toy store.
30. Display toy store which has maximum available quantity of lowest priced toys.
31. Display toy store with toy name and available quantity details for which stock is present but available quantity is <12.
32. Display age group wise total number of toys available for age group above 5.
33. Display toy store name where total number of toys available is greater than maximum available quantity for any toy.
34. Display toy store names that belong to the same city.
35. Display toy names that have the same price.
36. Display toy store which has not stored any toys yet.
37. Display Toys that are not available in any toy store yet.
38. Display Toy store name with Toy names it sells, also those stores which do not sell any toys yet should be displayed.
39. Display Toy store name with Toy names it sells, also those toys which are not sold in any toy store yet should be displayed.
40. Display Toy store name with Toy names it sells, also those stores which do not sell any toys yet should be displayed including
those toys which are not sold in any toy store yet.
41. Display stores that do not sell toys below rating of 3.
42. Display stores that do not sell toys that do not have maximum rating.
43. Display stores that do not give any discount.
44. Display toys that are sold only in one store exclusively i.e. not available in any other store.
45. Display details of toys having '_' (underscore) in their name.
46. Display details of Toys that have more than 6 characters in their name.
47. Display all toy prices in words like One Hundred Fifty
48. Display all Toy store and Toy names without any spaces like PingpongBall.
49. Display Toy name, Price and available quantity for Puzzles and More in following format Toy name**Price**Available Quantity. For
ex: Bat**500**3.
50. Display count of store names that start with the same first alphabet, also display that alphabet.

TCS Internal

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