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.
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
Q5. Insert the below records in the above table where email and phone no is null
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 firstname.lastname@example.org 987384584 104 Vishank Human M 89.78 email@example.com 456454565 105 Nikunj Human M 56.67 firstname.lastname@example.org 98459459 106 Pratham comm M 87.76 email@example.com 564565566 107 Mannat Comm. F 98.5 firstname.lastname@example.org NULL 108 Arushi Science F 99.56 email@example.com 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.