Skip to main content

GRADE XII - MYSQL PRACTICE QUESTIONS

 GRADE XII 

MYSQL PRACTICE QUESTIONS


1.For the following table answer the following questions

RTNO | AREA_COVERED | NO_OF_STUD | DISTANCE | TRANSPORTER | CHARGES

1                Rajiv Chowk                50                          10                       Anand Travel        10000

2                Old GGn                        54                          20                       Bhalla Co.              20000


    Que 1 . For the following table answer the following questions

a.   1.   Display all the bus details of those bus where no of students travelled is more than 100

b.     2. Display route no and area of those bus whose charges is more than 50000

c.     3. Reduce the charges of all those buses by 12% whose area covered starts with ‘V’

d.     4. Display the details of the anand travels and Bhalla co. transporters

e.     5. Delete all the records in which no of students travelled are less than 50

f.      6. Display all the records arranged in descending order of no of students

g.     7. Display the name of transporters who are providing service

h.     8. Increase the charges by 5% of those transports whose charges are between 40000 and 50000

i.      9. Add another column comment varchar(50) in the table

j.      10. Change the contents of comment column with ‘satisfactory’ for those routes whose distance is more than 30

 

a.   Sol:  1.Select * from bus;

2     2.Select * from bus where no_of_students>100;

3.    3.Select Rtno, area_covered from bus where charges>50000;

4.   4.update bus set chrges=charges-0.12* charges where area_covered like 'v%';

5.   5. Select * from bus where transporter IN ('Anand Travels','Bhalla Co.');

6.  6.Delete from bus where no_of_students<50;

7.  7. Select * from bus order by no_of_students desc;

8. 8. Select distinct(transporter) from bus;

9. 9. Update bus set charges=charges+0.05 * charges where charges between 40000 and 50000;

10 10. Alter table bus add comment varchar(50);

11 11.Update bus set comment="Satisfactory" where distance >30;



Comments

Popular posts from this blog

PYTHON - MYSQL CONNECTIVITY CODE

  #INSERTION OF DATA import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", passwd="root", database="school" ) print("Successfully Connected") #print(mydb) mycursor=mydb.cursor()   v1=int(input("enter ID:")) v2=input("enter name:") v3=input("enter Gender:") v4=int(input("enter age:")) sql='insert into TEACH values("%d","%s","%s","%s")'%(v1,v2,v3,v4) print(sql) mycursor.execute(sql) mydb.commit() print("record added") #MYSQL Connection code – Deletion on database SOURCE CODE: s=int(input("enter id of TEACHER to be deleted:")) r=(s,) v="delete from TEACH where id=%s" mycursor.execute(v,r) mydb.commit() print("record deleted") MYSQL Connection code – Updation on database SOURCE CODE: import mysql.connector mydb = mysql.connector.c...

REVISION IF CONSTRUCT | CLASS TEST

                                                                                     CLASS TEST 1. Write a Python program that asks the user for their age, gender, and current fitness level (beginner, intermediate, or advanced). Based on this information, suggest a suitable fitness plan using if-else statements. Requirements: Inputs : Age (integer) Gender (male/female) Fitness level (beginner/intermediate/advanced) Outputs : Recommend a fitness plan that includes: Suggested workout duration. Type of exercises (e.g., cardio, strength, flexibility). Rest days. Logic : Use if-else to determine the plan based on conditions such as: Age group (e.g., <18, 18–40, >40). Fitness leve...