How Well You know MYSQL

                                                               Question:-

Create a Table named as Elevn with A database named Markheet

where Table is like this.

where RNO and Name = Varchar

and Physics ,maths,Chemistry,total= integer

    RNO            NAME           Physics           Maths          Chemistry           Total

     1                 Ram                89                    92                  83            

     2                 Sam                 67                    78                  99

     3                 Ron                  76                   98                  65

     4                 Julia                 100                  34                 54

     5                 Harry                80                    9                  95

                                               Questions-

1. Change value of maths of student harry from 9 to 98

2. Display details of students in descding order

3. Calculate total marks of  each student

4. add a new column named Percentage

5. Do Calculate Percentage of each student

6. Find The Student who scored highest and lowest Marks

7. Delete record of Julia

8.Display Marks of student  in physics

  1. in descending order.

   2. In acsecding order.

9. Change Datatype of  RNO from Varchar to int

10.Use select command with a wildcard

11. Rename  Elevn as Eleven

12.Making use of select command show  use of 

1. clauses (where ,in, from)

2,arithemtic operator

3. && and Or operator

4.Like keyword.

13.Delete Database Markheet. and Then Create a new Database Marksheet.

---------------------------------------------------------------------------------------------------

                                                  *****************

                                           Now Answers of the question .

Ans:=

// Create table and Marksheet

create database Markheet;

create table elevn(

RNO varchar(4),

Name varchar(8),

Physics int,

Chemistry int,

Maths int,

Total int);

Alter table elevn add percentage float;

insert into elevn(RNO,Name,Physics,Chemistry,Maths,Total,percentage) values('1','Ram',89,92,83,(Physics+Chemistry+Maths),total/3);

insert into elevn(RNO,Name,Physics,Chemistry,Maths,Total,percentage) values('2','sam',67 ,  78,   99,(Physics+Chemistry+Maths),total/3);

insert into elevn(RNO,Name,Physics,Chemistry,Maths,Total,percentage) values('3','Ron',76  , 98,  65,(Physics+Chemistry+Maths),total/3);

insert into elevn(RNO,Name,Physics,Chemistry,Maths,Total,percentage) values('4','Julia',100  ,34,  54,(Physics+Chemistry+Maths),total/3);

insert into elevn(RNO,Name,Physics,Chemistry,Maths,Total,percentage) values('5','Harry',   80  ,  9   ,  95,(Physics+Chemistry+Maths),total/3);

update elevn  set Chemistry=98,Total=Physics+Chemistry+Maths,percentage=Total/3 where RNO='5';

1.update elevn  set Chemistry=98,Total=Physics+Chemistry+Maths,percentage=Total/3 where RNO='5';

2. Select * from elevn order by Total desc;

3. (Physics+Chemistry+Maths)= Total;

4. Alter table elevn add percentage float;

5. Percentage= Total/3

6.Highest= Harry

  Lowest= Julia

7.Delete from elevn where RNO='4';


8. Select * from elevn order by Physics desc;

Select * from elevn order by Physics asc;


9.Alter table elevn modify RNO int;


10. Select * from elevn;


11.Alter table elevn Rename to Eleven;

Desc Elevn;


                           Question 12

1. Select * from elevn where percentage in (91,62.3,66,80,46,50);

2. Select * from elevn Where total/3=91;

3.Select * from elevn Where percentage=91 or percentage= 62.3;

Select * from elevn Where percentage=91 && percentage= 91.00;

4.Select * from elevn Where Name like 'R%';

-- this will show name starting with  R

to show name ending with  m

Select * from elevn Where Name like '%m';


13. drop database Markheet;

create database Marsheet;



Comments

Popular posts from this blog

How to Create a Video Login page in Jframe In Java Netbeans

How to Create a ProgressBar with a button in Java Netbeans.

Airline Ticket Reservation System Project in Java Netbeans