Name: Akash Sonawane PRN:240250123002
Problem statement 1:
- Create a database named college and created a table name student in college
database with following structure
- roll,name,class,marks,age with respective data types.
- Check the structure of the table.
- Alter the datatype of marks from float to integer
Name: Akash Sonawane PRN:240250123002
- Alter the table to remove the column age
- Show all the tables in the database college.
Name: Akash Sonawane PRN:240250123002
- Truncate the table student
- Drop the table and database also.
Name: Akash Sonawane PRN:240250123002
Problem Statement – 2
- Create a database named college
- Create a table name student in college database with following structure
roll,name,class,marks,age with respective datatypes.
- Insert at least 5 rows in the table.
- Delete the entry of roll number 4
- Update the marks of roll number 3
Name: Akash Sonawane PRN:240250123002
- Give additional grace marks of 0.5 to all students.
- Truncate the table
Name: Akash Sonawane PRN:240250123002
- Insert the data again using multi-insert statement.
Name: Akash Sonawane PRN:240250123002
Problem statement 3 :
Q1. Create database SPJ.
Q2. Create table S with `S#` CHAR(5),Sname CHAR(20),Status SMALLINT,City CHAR(15)
Name: Akash Sonawane PRN:240250123002
Q3. Insert Values
S1,Smith,20,London
'S2','Jones',20,'Paris'
'S3','Blake',20,'Paris'
'S4','Clark',20,'London'
'S5','Adams',20,'Athens'
Name: Akash Sonawane PRN:240250123002
Q4. Create table P with `p#` char(6),Pname char(20),Color char(6),Weight smallint, City
char(15)
Q5. Insert Values
'P1','Nut','Red',12,'London'
'P2','Bolt','Green',17,'Paris'
'P3','Screw','Blue',17,'Rome'
'P4','Screw','Red',14,'London'
'P5','Cam','Blue',12,'Paris'
'P6','Cog','Red',19,'London'
Name: Akash Sonawane PRN:240250123002
Q6. Create table J `J#` char(4),Jname char (10), City char(15)
Q7. Insert Values
'J1','Sorter','Paris'
'J2','Punch','Rome'
'J3','Reader','Athens'
'J4','Console','Athens'
'J5','Collator','London'
'J6','Terminal','Oslo'
'J7','Tape','London'
Q8. Create Primary keys S#, P# and J#.
Ans While Creating Tables Parameters Assigned by Primary Key.
Q9. Create city in J table as foreign key in S table.
Name: Akash Sonawane PRN:240250123002
Q10. Add a new supplier S6, named 'White', status 30, from 'Berlin'.
Ans.
Q11. Add a new part P7, named 'Spring', color 'Black', weight 10, city 'Vienna'.
Name: Akash Sonawane PRN:240250123002
Q12. Add a new project J8, named 'Robot', located in 'Berlin'.
Q13. Display all suppliers from Paris.
Q14. List all red-colored parts.
Q15. Show all projects not located in London.
Q16. Get all suppliers whose status is greater than 20.
Name: Akash Sonawane PRN:240250123002
Q17. Update the status of supplier S2 to 35.
Q18. Change the city of part P3 from 'Rome' to 'Berlin'.
Q19. Rename the project J4 from 'Console' to 'Dashboard'.
Q20. Delete the supplier S5.
Name: Akash Sonawane PRN:240250123002
Q21. Remove all parts that weigh more than 15.
Q22. Delete all projects from 'Oslo'.
Q23. Add a column Email to the S table.
Q24. Remove the Email column from the S table.
Name: Akash Sonawane PRN:240250123002
Q25. Rename column Sname to SupplierName.
Q26. Change Status from SMALLINT to INT.