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:
- Select 75 + 3*2
- Select 23 + 56%5
- Select power(2,3)
- Select round(10.237,2)
- Select round(12.3454,2)
- Select round(12.3444,2)
Q5. Write the query on the basis of the following table :STUDENT
Name, Admno, Subject, Average, Position
- 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:
- Select 75 + 3*2 ------------------------------------Ans. 81
- Select 23 + 56%5----------------------------------Ans. 24
- Select power(2,3)----------------------------------Ans. 8
- Select round(10.237,2)----------------------------Ans. 10.24
- Select round(12.3454,2)---------------------------Ans. 12.35
- 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
- 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