MySQL Assignment on insert update and delete Command


MySQL Assignment on insert update and insert Command. This is the second assignment in the array of MySQL assignments. Few questions of this assignment also need prior knowledge of DDL commands.

MySQL assignment on Create Alter and Drop Command

Try these queries on any version of MySQL as they are the basic queries and every student must be familiar with these basic DML commands.

Q1. Insert , Delete and Update commands comes under DDL /DML commands?

Q2. What is the Syntax of Insert command.

Q3. Create a table student with the following specifications

S.no FieldName Data Type Size Constraints
1 Admno   Char 10 Primary key
2 Name    VARCHAR 30 Not Null
3 Stream  Varchar 20 NOT null
4 Gender  Char 1
5 Marks   Float 6,2
6 Email   Char 60
7 Phone   Char 15

Q4. Insert a new record in this table student with the following values
(101,’rakesh’,’science’,’M’,89.90,’rakesh@gmail.com’,’9871818181’)

Q5. Insert the below records in the above table where email and phone no is null
(102,’swarnima’,’science’,’F’,98.99)

Q6. Insert multiple records using single insert command. The records are as shown below

Admno    Name     Stream    Gender    Marks    Email                       Phone
103          Unnati   Comm       F             78.78     unnati@gmail.com 987384584
104 Vishank Human M 89.78 vishank@gmail.com 456454565
105 Nikunj Human M 56.67 nikunj@company.in 98459459
106 Pratham comm M 87.76 pratham@yahoo.com 564565566
107 Mannat Comm. F 98.5 manna@yahoo.com NULL
108 Arushi Science F 99.56 arushi@yahoo.in 9988776655

Q7. Give an increment of 10 marks to all the female students.

Q8. Replace all the NULL phone numbers with ‘9999999999’ where gender is female

Q9. Give an increment of 10% marks to each male student.

Q10. Change the emails of all the students where the email domain name is yahoo.com to yahoo.in

Q11. Delete records of all those students whose marks are less than 60%

Q12. Delete records of all those students where gender is female and marks between 70% and 80%

Q13. Create a table female from the table student where all the students are female ( use of the select command is required in this command)

Q14. Suppose a new column website added with the following command

     Alter table student add website char(60)

What will be the default values in this column?

Q15. How to delete all the rows of a table leaving its structure intact.

You can look into the basic tutorial on MySQL Insert Command, Delete command, and MySQL Update command to solve this MySQL assignment on insert, delete and update command.

Print Friendly, PDF & Email

Related Posts

If you like CBSEToaday and would like to contribute, you can also write an article using submit article or mail your article to contribute@cbsetoday.com See your article appearing on the cbsetoday.com main page and help other students/teachers.