Computer Science - Informatics Practices Class XI/XII MySQL Test Series Part 10

Computer Science - Informatics Practices Class XI/XII MySQL Test Series Part 10

Q1. What is the difference between drop and delete command?

Q2. Differentiate between Alter and Update command.

Q3. What is group by clause?

Q4. Write the output of the following:

  1. Select 75 + 3*2 
  2. Select 23 + 56%5
  3. Select power(2,3)
  4. Select round(10.237,2)
  5. Select round(12.3454,2)
  6. Select round(12.3444,2)
Q5. Write the query on the basis of the following table :STUDENT 
Name, Admno, Subject, Average, Position
  1. Display all records in ascending order by name
      
      2. Display details of students whose position is "First" and average greater than 70
 
      
     3. Display details of "Amit", "Sumit" and "Ashish" (using IN operator)

     
    4. Display Name and Subject  of student whose position is "First"

    
   5. Display the total number of records present in above table.

   6. Display the maximum average.
 
   7. Display name of student who got maximum average.

   8. Insert he following record:
      "Shikha", 1221, "Physics", 70, "Second"

 


SOLUTIONS

Q1. What is the difference between drop and delete command?

Ans. Drop command delete the data as well as structure of table permanently from database

        while delete command delete only the data from the table.

Q2. Differentiate between Alter and Update command.

Ans. Alter command is used to change the structure of table and Update command is used 

       to modify the data of table.

Q3. What is group by clause?

Ans. This clause is used to arrange same data in groups using some group functions 

        like Sum, average etc.

Q4. Write the output of the following:

  1. Select 75 + 3*2 ------------------------------------Ans. 81
  2. Select 23 + 56%5----------------------------------Ans. 24
  3. Select power(2,3)----------------------------------Ans. 8
  4. Select round(10.237,2)----------------------------Ans. 10.24
  5. Select round(12.3454,2)---------------------------Ans. 12.35
  6. Select round(12.3444,2)---------------------------Ans. 12.34
Q5. Write the query on the basis of the following table :STUDENT 
Name, Admno, Subject, Average, Position
  1. Display all records in ascending order by name
      Ans. Select * from Student order by Name;

      2. Display details of students whose position is "First" and average greater than 70
 
      Ans. Select * from student where position ="First" and Average >70;

     3. Display details of "Amit", "Sumit" and "Ashish" (using IN operator)

     Ans. Select * from Student where Name IN("Amit", "Sumit", "Ashish");

    4. Display Name and Subject  of student whose position is "First"

    Ans. Select Name, Subject from student where position = "First";

   5. Display the total number of records present in above table.

   Ans. Select count(*) from Student.

   6. Display the maximum average.
 
   Ans. Select max(Average) from Student;

  7. Display name of student who got maximum average.

   Ans. Select Name, max(Average) from Student;

  8. Insert he following record:
      "Shikha", 1221, "Physics", 70, "Second"

  Ans. Insert into student values ("Shikha", 1221, "Physics", 70, "Second");

No comments:

Post a Comment

Most Recently Published

File Handling Test 6

 File Handling Test 6 Q1 . Do we need to use the close() function when we use 'with' statement to open a file? Q2. Which mode you wi...

CS - IP Assignment/Worksheet