You are on page 1of 6

Sql Practical Question for Practice:

1. Consider the given table Player and answer the questions given below:

TABLE: PLAYER

1. To display the details of Players who scored centuries in ascending order of their name.
2. To increase the salary of Player by 50% if he scored a century.
3. To list the names of those Players whose name length is 5 characters and end with 'ESH’.
4. To display unique city from table Player.
5. add a new record in above table with the following data:
(8, piyush, kota, 90, 14000)
6. List the names of Players who belong to city jaipur or tonk.
7. Mr. Ram wants to add one more column "coach_name”. Help ram to write commands.
8. To Display records in descending order of Salary.
2. Consider the given table Player and answer the questions given below:

TABLE: Garment

Gcode Description Price Fcode Readydate


10023 Pencil Skirt 1150 F03 19-Dec-08
10001 Formal Shirt 1250 F01 12-Jan-08
10012 Informal Shirt 1550 F02 06-Jun-08
10024 Baby Top 750 F03 07-Apr-07
10090 Tulip Skirt 850 F02 31-Mar-07
10019 Evening Gown 850 F03 06-Jun-08
10009 Informal Pant 1500 F02 20-Oct-08
10017 Formal Pant 1350 F01 09-Mar-08
10020 Frock 850 F04 09-Sep-07
10089 Slacks 750 F03 31-Oct-08

1. To display Gcode and description of each garments in descending order of Gcode.


2. To display the details of all the garments, which have readydate in between 08-dec-07 and 16-Jun-08
(inclusive of both the dates).
3. To display the average price of all the garments, which are made up of Fabric with Fcode as F03.
4. To display fabric wise highest and lowest price of garments from garments table. (Display Fcode of
each garments along with highest and lowest price)
5. To display the names of those garments, whose length is 5 characters and end with “ock”.
6. Display details of garments, whose description in formal and informal.
7. Update datatype of description with char(50).
8. Increase price with 10% and update in a new column called final_price.
3. Consider the given table STORE and write sql commands of the questions given
below:

Storeid Name Location City Noofemp Dateopen Salesamt


S101 Planet Fashion Bandra Mumbai 7 2015-10-16 40000
S102 Vogue Karol Bagh Delhi 8 2015-07-14 120000
S103 Trends Powai Mumbai 10 2015-06-24 30000
S104 Super Fashion Thane Mumbai 11 2015-02-06 45000
S105 Annabelle South extn. Delhi 8 2015-04-09 60000
S106 Rage Defence Colony Delhi 5 2015-03-01 20000

1. To display the details of the store in alphabetical order of name.


2. To display the City and the number of stores located in that City, only if the
number of stores is more than 2.
3. Increase 10% salesamt of “Mumbai” city and noofemp should be greater than 10.
4. To display the total no of employee city wise and average of sales amount is
greater than 50000.
5. To display the details of store where store name start with “p” or “s” and ending
with “n”.
6. To display maximum and minimum sales amount city wise.
7. To display the details of stores having store id is S101, S103, S105.
4. Consider the given table SCHOOL and write sql commands of the questions given
below:

Admno Name Class House Percentage Gender


20150001 Abhishek Kumar 10 Green 86 Male
20140212 Mohit Bhardwaj 11 Red 75 Male
20090234 Ramandeep Kaur 10 Yellow 84 Female
20130236 Mukesh Sharma 9 Red 91 Male
20190227 Rahil Arora 10 Blue 70 Male
20120200 Swapnil Bhatt 11 Red 64 Female

1. Display the total number of students in each House where the number of students
are more than 2.
2. Display the average Percentage of girls and boys.
3. Display the minimum Percentage secured by the students of Class 10.
4. Display the details where name starts with “A” or “r” and end with “r” or “a”.
5. Display the name of students whose percentage is between 80 to 90.
6. Display the details of school in increasing order of percentage.
7. Display the total no of student class wise and gender is male.
5. Write SQL query for the followings- (Relation: Student)

1. To display Name and marks of all the students in ascending order of their marks.
2. To display rollno and Name of all students located in moscow.
3. To display Minimum and Maximum marks of each city.
4. To display no of students in each city and class is XI.
5. To display name of student whose gender is F and date of birth is before 1996.
6. Display the list of students, who are not study in class X.
7. Update name column with datatype of char(50).
8. Change the column name of rollno to rno.
6. Write SQL query for the followings- (Relation: Furniture) 8 Marks

FCODE NAME PRICE MANUFDATE WCODE

10023 Coffee table 4000 19-DEC-2016 W03

10001 Dining table 20500 12-JAN-2017 W01

10012 Sofa 35000 06-JUN-2016 W02

10024 Chair 2500 07-APR-2017 W03

10090 Cabinet 18000 31-MAR-2015 W02

1. To display FCODE, NAME and PRICE of items that have Price less than 5,000.
2. To display NAMES and PRICE of those Furniture Items that have 'table' anywhere in their name.
3. To display WCode of Furniture Items. There should be no duplicate values.
4. To display the NAMES and PRICE increased by 500.00 of all the furniture items. (Price should only
be displayed as increased; there should be no increase in the data in the table).
5. To display FCODE and NAME of each Furniture Item in descending order of FCODE.
6. To display the average PRICE of all the Furniture Items, which are made of WCODE as W02.
7. To display WCODE wise, WCODE and the highest price of Furniture Items.
8. Display details of furniture where furniture name having 5th character “e” and last character is “E“.

You might also like